

A277618


Lexicographically earliest nonnegative sequence such that a(n+1)a(n) is a prime number, and no number occurs twice; a(0) = 0.


4



0, 2, 4, 1, 3, 5, 7, 9, 6, 8, 10, 12, 14, 11, 13, 15, 17, 19, 16, 18, 20, 22, 24, 21, 23, 25, 27, 29, 26, 28, 30, 32, 34, 31, 33, 35, 37, 39, 36, 38, 40, 42, 44, 41, 43, 45, 47, 49, 46, 48, 50, 52, 54, 51, 53, 55, 57, 59, 56, 58, 60, 62, 64, 61, 63, 65, 67, 69, 66, 68, 70, 72, 74, 71, 73, 75, 77, 79, 76, 78, 80, 82, 84, 81, 83, 85, 87, 89, 86, 88, 90
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

A variant of A277616, which is defined in a similar way with squares > 1 instead of primes.
The steps a(n+1)a(n) are either +2 or 3, after 10 terms we get a(n+10), and the first 10 terms are all numbers between 0 and 9: This sequence is obviously a permutation of the nonnegative integers, with a(n) = a(n5) + 5 for all n > 5. The strictly positive variant (starting with a(1) = 1) is given by A065186.


LINKS

Table of n, a(n) for n=1..91.


FORMULA

a(n) = a(n5) + 5 for all n > 5.
a(n) = A065186(n+1)  1.


MATHEMATICA

Table[n  2 + Mod[n  3, 5], {n, 0, 500}] (* Fred Patrick Doty, Aug 03 2020 *)


PROG

(PARI) {u=[a=0]; (chk(n)=(!#u(n>u[1]&&!setsearch(u, n)))&&(u=setunion(u, [n]))&&!while(#u>1&&u[2]==u[1]+1, u=u[^1])); for(n=1, 99, print1(a", "); for(k=primepi(a+!a1), 9e9, knext; chk(a+sign(k)*prime(abs(k)))next; a+=sign(k)*prime(abs(k)); break))}
(PARI) A277618(n, i=[0, 2, 4, 1, 3])=i[n%#i+1]+n\#i*#i


CROSSREFS

Cf. A277616, A277617, A065186.
Sequence in context: A258240 A198578 A173658 * A219250 A282891 A117137
Adjacent sequences: A277615 A277616 A277617 * A277619 A277620 A277621


KEYWORD

nonn


AUTHOR

Eric Angelini and M. F. Hasler, Oct 23 2016


STATUS

approved



