login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A330615
a(0) = 1; a(1) = 1; a(n) = a(a(n - 1) mod n) + a(a(n - 2) mod n).
1
1, 1, 2, 3, 5, 4, 9, 7, 8, 15, 12, 6, 10, 21, 19, 14, 22, 23, 9, 20, 16, 38, 44, 52, 21, 40, 57, 24, 22, 65, 48, 26, 79, 78, 18, 17, 32, 102, 136, 41, 23, 53, 58, 26, 76, 83, 150, 47, 56, 54, 14, 22, 63, 56, 17, 24, 44, 97, 117, 253, 118, 112, 58, 171, 143, 74
OFFSET
0,3
COMMENTS
Periodic with period 63584 starting at n = 441329.
EXAMPLE
n = 8: a(7) = 7, a(6) = 9, so a(8) = a(a(7) mod 8) + a(a(6) mod 8) = a(7 mod 8) + a(9 mod 8) = a(7) + a(1) = 7 + 1 = 8.
MATHEMATICA
a[0] = a[1] = 1; a[n_] := a[n] = a[Mod[a[n-1], n]] + a[Mod[a[n-2], n]]; Array[a, 66, 0] (* Amiram Eldar, Dec 21 2019 *)
PROG
(Python 3) # Lists terms up to given n.
def a_list(n):
a=[1, 1]
for k in range(2, n+1):
a.append(a[a[-1]%k]+a[a[-2]%k])
return a
CROSSREFS
Cf. A308818 (similar sequence with initial conditions a(0) = 2, a(1) = 3).
Sequence in context: A096116 A259431 A085875 * A302850 A338253 A060030
KEYWORD
nonn
AUTHOR
Jack Kiuttu, Dec 20 2019
STATUS
approved