login
A256985
Define a sequence {b(i), i >= 0} by b(i) = 1 for 0 <= i <= n, thereafter b(i+1) = (b(i)+b(i-n)) mod 10; consider the sequence of n-tuples [b(i-n+1), b(i-n+2),...,b(i)]; this repeats with period a(n).
1
60, 217, 520, 42, 196812, 2480437, 2232, 7128815, 1736327236, 124516392, 203450520, 40193528485, 14417724597564, 22856442972, 324145501174, 7946757, 193726348876699204, 206135768515040, 581179046630097612, 32289695739703771, 275114595439871720
OFFSET
1,1
LINKS
Popular Computing (Calabasas, CA), Contest 9, Vol. 4 (No. 40, July 1976), scanned copy of page PC40-1.
Popular Computing (Calabasas, CA), Contest 9, Vol. 4 (No. 40, July 1976), scanned copy of page PC40-3.
EXAMPLE
For n=1 we get the Fibonacci sequence (starting 1,1,2,3,...), A000045, which read mod 10 repeats with period 60 (see A003893), so a(1)=60. The full period in this case is:
[1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, 1, 6, 7, 3, 0, 3, 3, 6, 9, 5, 4, 9, 3, 2, 5, 7, 2, 9, 1, 0].
PROG
(Python)
from itertools import accumulate # requires python 3.2 or higher
def A256985(n):
....ilist, k = [1]*(n+1), 1
....jlist = [d % 10 for d in accumulate(ilist)]
....jlist = [jlist[-1]]+ jlist[:-1]
....while ilist != jlist:
........k += 1
........jlist = [d % 10 for d in accumulate(jlist)]
........jlist = [jlist[-1]]+ jlist[:-1]
....return k # Chai Wah Wu, Apr 30 2015
CROSSREFS
Sequence in context: A126248 A224335 A068628 * A075287 A277990 A103741
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Apr 26 2015
EXTENSIONS
a(6)-a(11) from Chai Wah Wu, Apr 30 2015
a(12)-a(21) from Hiroaki Yamanouchi, May 04 2015
STATUS
approved