login
A305845
a(1) = a(2) = a(3) = 1; for n > 3, a(n) = a(a(n-2)) + a(n-a(n-2)).
2
1, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 6, 7, 7, 7, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 17, 17, 18, 18, 18, 19, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 35, 36, 37, 37, 38, 39, 39, 39
OFFSET
1,4
COMMENTS
A solution to recursion of Mallows's sequence (A005229).
FORMULA
a(n+1) - a(n) = 0 or 1 for all n >= 1.
MATHEMATICA
a[1] = a[2] = a[3] = 1; a[n_] := a[n] = a[a[n - 2]] + a[n - a[n - 2]]; Array[a, 81] (* Michael De Vlieger, Jun 11 2018 *)
PROG
(PARI) a=vector(100); a[1]=a[2]=a[3]=1; for(n=4, #a, a[n] = a[a[n-2]] + a[n-a[n-2]]); a
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Jun 11 2018
STATUS
approved