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

%I #42 Mar 07 2017 00:34:38

%S 0,0,1,3,0,2,5,0,3,6,9,2,6,10,1,5,10,16,3,9,15,21,4,13,20,1,9,17,25,3,

%T 14,22,30,7,18,27,0,11,21,32,3,14,26,38,5,16,27,46,8,19,35,49,8,23,38,

%U 51,11,25,41,57,12,27,50,2,15,35,52,67,19,40,58,5,25,44,64,7,28,47,67,9,31,52,73,13,34,56,80,16,38,62,86,18

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

%C Numbers n such that a(n) = 0 are 1, 2, 5, 8, 37, 99, 1580, 42029, ...

%C Sequence is a mixture of regularity and irregularity. - Douglas Hofstadter, Mar 03 2017

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

%H Altug Alkan, <a href="/A283025/a283025_2.png">Alternative Graph of A283025</a>

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

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

%F a(n) = A076268(n) mod n.

%e a(4) = 3 since Sum_{k=1..4} A005185(k) = 1 + 1 + 2 + 3 = 7 and remainder when 7 is divided by 4 is 3.

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

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

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

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

%t h[1]=h[2]=1; h[n_]:=h[n]= h[n-h[n-1]] + h[n-h[n-2]]; Mod[ Accumulate[h /@ Range[100]], Range[100]] (* _Giovanni Resta_, Feb 27 2017 *)

%o (PARI) a=vector(1000); a[1]=a[2]=1; for(n=3, #a, a[n]=a[n-a[n-1]]+a[n-a[n-2]]); vector(#a, n, sum(k=1, n, a[k]) % n)

%o (PARI) first(n)=my(v=vector(n), s); v[1]=v[2]=1; for(k=3, n, v[k]=v[k-v[k-1]]+v[k-v[k-2]]); for(k=1, n, s+=v[k]; v[k]=s%k); v \\ after _Charles R Greathouse IV_ at A282891

%Y Cf. A005185, A076268, A282891, A282894.

%K nonn,look

%O 1,4

%A _Altug Alkan_, Feb 27 2017