login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
a(1) = 1; a(2n) = A065090(1+a(n)), a(2n+1) = A065091(a(n)).
As a composition of other permutations:
a(n) = A257729(A246378(n)).
a(n) = A257802(A257726(n)).
PROG
(PARI)
A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from M. F. Hasler
A257728(n) = if(n<3, n, if(!(n%2), A002808(A257728(n/2)-1), prime(1+A257728((n-1)/2))));
for(n=1, 4096, write("b257728.txt", n, " ", A257728(n)));
(Scheme, with memoizing definec-macro)
(definec (A257728 n) (cond ((< n 2) n) ((even? n) (A065090 (+ 1 (A257728 (/ n 2))))) (else (A065091 (A257728 (/ (- n 1) 2))))))
CROSSREFS
Inverse: A257727.
Related or similar permutations: A246377, A246378, A257726, A257729, A257802.
Differs from A255004 for the first time at n=17, where a(17) = 23, while A255004(17) = 15.
Sequence in context: A358277 A361513 A255004 * A329303 A330091 A175948
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 09 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)