OFFSET
1,4
COMMENTS
At each step, the minimum available integer is used.
From Rémy Sigrist, Aug 12 2017: (Start)
a(n)=0 iff n belongs to A074271.
a(n)=1 iff n > 1 and n belongs to A259408.
For any k > 0, A064427(k) = least n such that a(n) = k-1.
(End)
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1)=0. Next 0 is at distance 2 (1st prime): a(3)=0.
a(2)=1. Next 1 is at distance 3 (2nd prime): a(5)=1.
a(3)=0. Next 0 is at distance 5 (3rd prime): a(8)=0.
For a(4), we can use neither 0 (distance 1 from previous 0 would lead to an incongruence) nor 1 (distance 1 from subsequent 1 would lead to another incongruence). Therefore we must use 2.
Next 2 must be at distance 7 (4th prime): a(11)=2. And so on.
MAPLE
P:=proc(q, h) local i, k, n, t, x; x:=array(1..h); for k from 1 to h do x[k]:=-1; od; x[1]:=0; i:=0; t:=0; for n from 1 to q do if isprime(n) then i:=i+1; if x[i]>-1 then x[i+n]:=x[i]; else t:=t+1; x[i]:=t; x[i+n]:=x[i]; fi; fi; od; seq(x[k], k=1..79); end: P(400, 500);
PROG
(PARI) a = vector(71, i, -1); u = 0; for (n=1, #a, if (a[n]<0, o = n; while (o <= #a, a[o] = u; o += prime(o)); u++); print1 (a[n] ", ")) \\ Rémy Sigrist, Aug 12 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paolo P. Lava & Giorgio Balzarotti, Nov 03 2010
EXTENSIONS
More terms from Rémy Sigrist, Aug 12 2017
STATUS
approved