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

%I #18 Sep 23 2014 10:55:39

%S 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,

%T 22,120,61,58,63,124,48,52,18,40,25,112,32,44,27,240,21,122,116,126,

%U 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

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

%C 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.

%C 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).

%C 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, ...).

%H Antti Karttunen, <a href="/A246377/b246377.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F 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)).

%F As a composition of related permutations:

%F a(n) = A054429(A135141(n)).

%F a(n) = A135141(A236854(n)).

%F a(n) = A246376(A246379(n)).

%F a(n) = A246201(A245703(n)).

%F a(n) = A243071(A246681(n)). [For n >= 1].

%F Other identities.

%F For all n > 1 the following holds:

%F 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].

%o (Scheme, with memoizing definec-macro)

%o (definec (A246377 n) (cond ((< n 2) n) ((= 1 (A010051 n)) (+ 1 (* 2 (A246377 (A000720 n))))) (else (* 2 (A246377 (A065855 n))))))

%Y Inverse: A246378.

%Y Cf. A000720, A010051, A065855, A071904, A246348, A246369, A246370.

%Y Other related or similar permutations: A135141, A054429, A246201, A245703, A246376, A246379, A243071, A246681, A236854.

%Y Differs from A237427 for the first time at n=19, where a(19) = 29, while A237427(19) = 62.

%K nonn

%O 1,2

%A _Antti Karttunen_, Aug 27 2014