login
Remainder when sum of first n terms of A004001 is divided by n.
6

%I #25 May 14 2017 20:35:46

%S 0,0,1,2,4,1,3,5,8,2,6,10,2,6,10,14,2,7,13,0,6,13,21,5,13,21,2,10,18,

%T 26,3,10,18,27,2,12,23,34,7,19,32,3,16,30,44,13,27,41,7,22,37,1,16,31,

%U 47,7,22,37,53,9,24,39,54,5,20,36,53,3,21,40,59,7,27,48,70,16,38,61,6,29,53,78,20,45,70,9,34,60,87,24

%N Remainder when sum of first n terms of A004001 is divided by n.

%C Numbers n such that a(n) = 0 are 1, 2, 20, 4743, 10936, ...

%H Altug Alkan, <a href="/A282891/b282891.txt">Table of n, a(n) for n = 1..10000</a>

%H Altug Alkan, <a href="/A282891/a282891.png">Alternative Scatterplot of A282891</a>

%H Altug Alkan, <a href="/A282891/a282891_1.png">Illustration Of Residue Classes Modulo 4</a>

%F a(n) = (Sum_{k=1..n} A004001(k)) mod n.

%e 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.

%p A004001:= proc(n) option remember; procname(procname(n-1)) +procname(n-procname(n-1)) end proc:

%p A004001(1):= 1: A004001(2):= 1:

%p L:= ListTools[PartialSums](map(A004001, [$1..1000])):

%p seq(L[i] mod i, i=1..1000); # _Robert Israel_, Feb 24 2017

%t 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 *)

%o (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

%Y Cf. A004001, A282894, A283025.

%K nonn,look

%O 1,4

%A _Altug Alkan_, Feb 24 2017