OFFSET

0,4

LINKS

Samuel B. Reid, Table of n, a(n) for n = 0..10000

Samuel B. Reid, Colored plot of one billion terms. This plot is normalized by column. Within each column, density corresponds, in a linear fashion, to this spectrum.

Samuel B. Reid, Distribution, between 0 and n, of the first billion terms

EXAMPLE

a(1) = 1 - a(0 mod 1) = 1.

a(2) = 2 - a((0+1) mod 2) = 1.

a(3) = 3 - a((0+1+1) mod 3) = 2.

a(4) = 4 - a((0+1+1+2) mod 4) = 4.

MATHEMATICA

a[0] = 0; a[n_] := a[n] = n - a[Mod[Sum[a[k], {k, 0, n - 1}], n]]; Array[a, 100, 0] (* Amiram Eldar, Dec 07 2019 *)

PROG

(PARI) s=0; for (n=1, #(a=vector(78)), print1 (a[n]=if (n==1, 0, (n-1)-a[1+(s%(n-1))])", "); s+=a[n]) \\ Rémy Sigrist, Dec 08 2019

CROSSREFS

KEYWORD

nonn

AUTHOR

Samuel B. Reid, Dec 07 2019

STATUS

approved