

A246377


Permutation of natural numbers: a(1) = 1, a(p_n) = 2*a(n)+1, a(c_n) = 2*a(n), where p_n = nth prime = A000040(n), c_n = nth composite number = A002808(n).


17



1, 3, 7, 2, 15, 6, 5, 14, 4, 30, 31, 12, 13, 10, 28, 8, 11, 60, 29, 62, 24, 26, 9, 20, 56, 16, 22, 120, 61, 58, 63, 124, 48, 52, 18, 40, 25, 112, 32, 44, 27, 240, 21, 122, 116, 126, 57, 248, 96, 104, 36, 80, 17, 50, 224, 64, 88, 54, 23, 480, 121, 42, 244, 232, 252, 114, 59, 496, 192, 208, 125, 72, 49, 160, 34, 100
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

This permutation is otherwise like Katarzyna Matylla's A135141, except that the role of even and odd numbers (or alternatively: primes and composites) has been swapped.
Because 2 is the only even prime, it implies that, apart from a(2)=3, odd numbers occur in odd positions only (along with many even numbers that also occur in odd positions).
This also implies that for each odd composite (A071904) there exists a separate infinite cycle in this permutation, apart from 9 and 15 which are in the same infinite cycle: (..., 23, 9, 4, 2, 3, 7, 5, 15, 28, 120, 82, 46, ...).


LINKS

Antti Karttunen, Table of n, a(n) for n = 1..10000
Index entries for sequences that are permutations of the natural numbers


FORMULA

a(1) = 1, and for n > 1, if A010051(n) = 1 [i.e. when n is a prime], a(n) = 1+(2*a(A000720(n))), otherwise a(n) = 2*a(A065855(n)).
As a composition of related permutations:
a(n) = A054429(A135141(n)).
a(n) = A135141(A236854(n)).
a(n) = A246376(A246379(n)).
a(n) = A246201(A245703(n)).
a(n) = A243071(A246681(n)). [For n >= 1].
Other identities.
For all n > 1 the following holds:
A000035(a(n)) = A010051(n). [Maps primes to odd numbers > 1, and composites to even numbers, in some order. Permutations A246379 & A246681 have the same property].


PROG

(Scheme, with memoizing definecmacro)
(definec (A246377 n) (cond ((< n 2) n) ((= 1 (A010051 n)) (+ 1 (* 2 (A246377 (A000720 n))))) (else (* 2 (A246377 (A065855 n))))))


CROSSREFS

Inverse: A246378.
Cf. A000720, A010051, A065855, A071904, A246348, A246369, A246370.
Other related or similar permutations: A135141, A054429, A246201, A245703, A246376, A246379, A243071, A246681, A236854.
Differs from A237427 for the first time at n=19, where a(19) = 29, while A237427(19) = 62.
Sequence in context: A243343 A255565 A227351 * A260421 A237427 A210203
Adjacent sequences: A246374 A246375 A246376 * A246378 A246379 A246380


KEYWORD

nonn


AUTHOR

Antti Karttunen, Aug 27 2014


STATUS

approved



