%I #11 Jun 15 2019 21:39:47
%S 0,0,1,2,3,0,4,5,1,6,7,2,8,3,9,0,10,11,4,12,13,5,14,1,15,6,16,17,7,18,
%T 19,2,20,8,21,3,22,23,9,24,0,25,10,26,11,27,4,28,29,12,30,31,13,32,5,
%U 33,14,34,1,35,15,36,37,6,38,16,39,17,40,41,7,42,43,18
%N Minimal sequence whose forwards van Eck transform is the sequence of nonprime numbers.
%C At each step, the minimum available integer is used.
%e a(1) = 0. Next 0 is at distance 1: a(2) = 0.
%e a(2) = 0. Next 0 is at distance 4: a(6) = 0.
%e For a(3) we cannot use 0 because the next 0 is at distance 3 that is a prime.
%e Therefore we must use 1: a(3) = 1.
%e Next 1 must be at distance 6, next composite after 4: a(9) = 1.
%e Again, for a(4) we cannot use neither 0 nor 1: a(4) = 2.
%e Next 2 must be at distance 8: a(12) = 2. And so on.
%p P:=proc(q,h) local i,k,n,t,x; x:=array(1..h);
%p for k from 1 to h do x[k]:=-1; od; x[1]:=0; i:=0; t:=0;
%p for n from 1 to q do if not isprime(n) then i:=i+1;
%p if x[i]=-1 then t:=t+1; x[i]:=t; fi; x[i+n]:=x[i];
%p fi; od; seq(x[k],k=1..124); end: P(160,300);
%Y Cf. A018252, A181642.
%K nonn,easy
%O 1,4
%A _Paolo P. Lava_, Mar 13 2018
|