[go: up one dir, main page]

login
A283509
Remainder when sum of first n terms of the Hofstadter Q-sequence is divided by 2*n.
2
1, 2, 4, 7, 0, 2, 5, 8, 12, 16, 20, 2, 6, 10, 16, 21, 27, 34, 3, 9, 15, 21, 27, 37, 45, 1, 9, 17, 25, 33, 45, 54, 63, 7, 18, 27, 37, 49, 60, 72, 3, 14, 26, 38, 50, 62, 74, 94, 8, 19, 35, 49, 61, 77, 93, 107, 11, 25, 41, 57, 73, 89, 113, 2, 15, 35, 52, 67, 88, 110, 129, 5, 25, 44, 64, 83, 105, 125, 146, 9, 31, 52, 73, 97
OFFSET
1,2
COMMENTS
Sequence represents c(n, 2) where c(n, i) = (Sum_{k = 1..n} A005185(k)) mod (n*i). See also A283025 and corresponding illustration in Links section.
EXAMPLE
a(4) = 7 since Sum_{k = 1..4} A005185(k) = 1 + 1 + 2 + 3 = 7 and remainder when 7 is divided by 8 is 7.
MAPLE
A005185:= proc(n) option remember; procname(n-procname(n-1)) +procname(n-procname(n-2)) end proc:
A005185(1):= 1: A005185(2):= 1:
L:= ListTools[PartialSums](map(A005185, [$1..1000])):
seq(L[i] mod (2*i), i=1..1000); # after Robert Israel at A283025
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = a[n - a[n - 1]] + a[n - a[n - 2]]; Table[Mod[Total@ Array[a, n], 2 n], {n, 84}] (* Michael De Vlieger, Mar 13 2017 *)
PROG
(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]) % (2*n))
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan, Mar 09 2017
STATUS
approved