Define the sequence A(n) as:
A(1) = 1, A(2) =13, A(3) = 131, A(4) = 1313,...
- Determine the minimum value of n such that A(n) is divisible by 29.
- What is the general form of n such that A(n) is divisible by 29?
10 A="1":N=1
20 while Ct<40
30 if val(A) @ 29=0 then print N,N-Prev,N @ 28:inc Ct:Prev=N
40 if right(A,1)="1" then A=A+"3":else A=A+"1"
50 inc N
60 wend
finds
valid diff mod 28
n from
prev
9 9 9
28 19 0
37 9 9
56 19 0
65 9 9
84 19 0
93 9 9
112 19 0
121 9 9
140 19 0
149 9 9
168 19 0
177 9 9
196 19 0
205 9 9
224 19 0
233 9 9
252 19 0
261 9 9
280 19 0
289 9 9
308 19 0
317 9 9
336 19 0
345 9 9
364 19 0
373 9 9
392 19 0
401 9 9
420 19 0
429 9 9
448 19 0
457 9 9
476 19 0
485 9 9
504 19 0
513 9 9
532 19 0
541 9 9
560 19 0
The valid n are congruent to either 9 or 0 mod 28.
The printing of N @ 28 (i.e., N mod 28) was added of course after seeing the difference column alternate 9 and 19.
|
Posted by Charlie
on 2014-01-14 11:55:29 |