OFFSET
1,4
COMMENTS
Numbers n such that a(n) = 0 are 1, 2, 20, 4743, 10936, ...
LINKS
Altug Alkan, Table of n, a(n) for n = 1..10000
Altug Alkan, Alternative Scatterplot of A282891
Altug Alkan, Illustration Of Residue Classes Modulo 4
FORMULA
a(n) = (Sum_{k=1..n} A004001(k)) mod n.
EXAMPLE
a(5) = 4 since Sum_{k=1..5} A004001(k) = 1 + 1 + 2 + 2 + 3 = 9 and remainder when 9 is divided by 5 is 4.
MAPLE
A004001:= proc(n) option remember; procname(procname(n-1)) +procname(n-procname(n-1)) end proc:
L:= ListTools[PartialSums](map(A004001, [$1..1000])):
seq(L[i] mod i, i=1..1000); # Robert Israel, Feb 24 2017
MATHEMATICA
a[1] = 1; a[2] = 1; a[n_] := a[n] = a[a[n - 1]] + a[n - a[n - 1]]; MapIndexed[Last@ QuotientRemainder[#1, First@ #2] &, Accumulate@ Table[a@ n, {n, 90}]] (* Michael De Vlieger, Feb 24 2017, after Robert G. Wilson v at A004001 *)
PROG
(PARI) first(n)=my(v=vector(n), s); v[1]=v[2]=1; for(k=3, n, v[k]=v[v[k-1]]+v[k-v[k-1]]); for(k=1, n, s+=v[k]; v[k]=s%k); v \\ Charles R Greathouse IV, Feb 26 2017
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Altug Alkan, Feb 24 2017
STATUS
approved