OFFSET
1,3
COMMENTS
The sequence of first differences contains only 1's and 4's (with an 8 at the beginning): 1 8 1 4 1 1 4 1 1 4 1 1 4 1 1 1 1 4 4 1 1 4 1 1 4 1 1 4 1 1 1 1 4 4 1 1 1 1 4 4 1 1 4 1 1 1 1 4 4
EXAMPLE
Begin with a(1)=0. Add to a(1) the least nonprime giving a nonprime number: + 1 = 1 for a(2). Now add to a(2) the least nonprime giving a composite: + 8 = 9 for a(3). Same rule: + 1 = 10 for a(4). Same rule: + 4 = 14 etc...
MATHEMATICA
f[s_List] := Block[{j = s[[ -1]]}, k = j + 1; While[PrimeQ[k] || PrimeQ[k - j], k++ ]; Append[s, k]]; Nest[f, {0}, 64] (* Robert G. Wilson v, Sep 23 2006 *)
PROG
(PARI) lista(nn) = my(va = vector(nn), last=0); for (n=2, nn, my(new = last+1); while(isprime(new) || isprime(new-last), new++); va[n] = new; last = new; ); va; \\ Michel Marcus, Aug 09 2022
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Alexandre Wajnberg and Eric Angelini, Sep 04 2005
EXTENSIONS
Extended by Ray Chandler, Sep 06 2005
STATUS
approved