|
|
A257728
|
|
Permutation of natural numbers: a(1)=1; a(2n) = not_an_oddprime(1+a(n)), a(2n+1) = oddprime(a(n)).
|
|
5
|
|
|
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, 22, 47, 34, 89, 27, 67, 52, 163, 24, 53, 42, 113, 32, 79, 60, 193, 25, 59, 45, 131, 38, 103, 84, 293, 30, 73, 57, 181, 40, 109, 95, 359, 33, 83, 65, 223, 49, 149, 119, 463, 39, 107, 91, 337, 72, 241, 209, 971, 35, 97, 74, 251, 58
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
As a composition of other permutations:
|
|
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
|
Differs from A255004 for the first time at n=17, where a(17) = 23, while A255004(17) = 15.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|