Let us denote f(n) = 12...12 (repeated n times) and g(n) = 3...3 (repeated n times). For example: f(3) = 121212 and, g(3) = 333.
(i) Determine the distinct digits in the base ten expansion of f(n)*g(n) whenever n ≥ 3
(ii) Express s.o.d (f(n)*g(n)) in terms of n
*** s.o.d (x) denotes the sum of digits in the base ten expansion of x
10 for N=1 to 27
20 Twlve=Twlve*100+12
30 Three=Three*10+3
40 print N,Twlve*Three,fnSod(Twlve*Three)
50 next N
60 end
70 fnSOD(X)
80 Sod=0
90 S=cutspc(str(X))
100 for I=1 to len(S)
110 Sod=Sod+val(mid(S,I,1))
120 next
130 return(Sod)
finds
n f(n)*g(n) sod(f(n)*g(n))
1 36 9
2 39996 36
3 40363596 36
4 40399999596 72
5 40403636359596 63
6 40403999999959596 108
7 40404036363635959596 90
8 40404039999999995959596 144
9 40404040363636363595959596 117
10 40404040399999999999595959596 180
11 40404040403636363636359595959596 144
12 40404040403999999999999959595959596 216
13 40404040404036363636363635959595959596 171
14 40404040404039999999999999995959595959596 252
15 40404040404040363636363636363595959595959596 198
16 40404040404040399999999999999999595959595959596 288
17 40404040404040403636363636363636359595959595959596 225
18 40404040404040403999999999999999999959595959595959596 324
19 40404040404040404036363636363636363635959595959595959596 252
20 40404040404040404039999999999999999999995959595959595959596 360
21 40404040404040404040363636363636363636363595959595959595959596 279
22 40404040404040404040399999999999999999999999595959595959595959596 396
23 40404040404040404040403636363636363636363636359595959595959595959596 306
24 40404040404040404040403999999999999999999999999959595959595959595959596 432
25 40404040404040404040404036363636363636363636363635959595959595959595959596 333
26 40404040404040404040404039999999999999999999999999995959595959595959595959596 468
27 40404040404040404040404040363636363636363636363636363595959595959595959595959596 360
There seems to be:
floor((n-1)/2) occurrences of "40" at the beginning of the number,
followed by
if n is odd: the first n digits of 36...36
if n is even: "3", then n+1 occurrences of "9"
followed by
floor((n-1)/2) occurrences of "59"
followed by
6
The portion of the s.o.d. that's common to the odd and even n is then:
18*floor((n-1)/2) + 6
For even n, we add 9*(n+1) + 3
That makes the total for even n: 18*(n/2 - 1) + 6 + 9*(n+1) + 3, which simplifies to:
18*n
For odd n, it would seem to depend on whether n is congruent to 1 or 3 mod 4. However, a look at the calculated sod's above shows that some of the irregularities cancel each other. The result looks like
27*(n-1)/2 + 9
|
Posted by Charlie
on 2012-09-19 16:46:19 |