OFFSET
1,2
COMMENTS
Here oddprime(n) = n-th odd prime = A065091(n) = A000040(n+1), not_an_oddprime(n) = n-th natural number which is not an odd prime = A065090(n).
This sequence can be represented as a binary tree. Each left hand child is produced as A065090(1+n), and each right hand child as A065091(n), when a parent contains n >= 1:
|
...................1...................
2 3
4......../ \........5 6......../ \........7
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
8 11 9 13 10 17 12 19
14 23 18 37 15 29 21 43 16 31 26 61 20 41 28 71
etc.
Because all odd primes are odd, it means that even terms can only occur in even positions (together with odd composites, A071904, for each one of which there is a separate infinite cycle), while terms in odd positions are all odd.
LINKS
FORMULA
PROG
(PARI)
A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from M. F. Hasler
for(n=1, 4096, write("b257728.txt", n, " ", A257728(n)));
(Scheme, with memoizing definec-macro)
CROSSREFS
Inverse: A257727.
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 09 2015
STATUS
approved