%I #13 May 10 2015 11:00:30
%S 1,2,3,4,5,6,7,8,10,12,9,14,11,16,20,24,13,18,15,28,22,32,17,40,48,26,
%T 36,30,21,56,25,44,64,34,80,96,19,52,72,60,29,42,23,112,50,88,33,128,
%U 68,160,192,38,41,104,144,120,58,84,49,46,27,224,100,176,66,256,37,136,320,384,31,76,57,82,208,288,240,116,45
%N Permutation of natural numbers: a(1) = 1, a(oddprime(n)) = 1 + 2*a(n), a(not_an_oddprime(n)) = 2*a(n-1).
%C 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).
%H Antti Karttunen, <a href="/A257727/b257727.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; a(2) = 2; and for n > 2, if A010051(n) = 1 [i.e., when n is a prime], then a(n) = 1 + 2*a(A000720(n)-1), otherwise a(n) = 2*a(A062298(n)).
%F As a composition of other permutations:
%F a(n) = A246377(A257730(n)).
%F a(n) = A257725(A257801(n)).
%e For n=2, which is the second natural number >= 1 that is not an odd prime [2 = A065090(2)], we compute 2*a(1) = 2 = a(2).
%e For n=4, which is A065090(3), we compute 2*a(3-1) = 2*2 = 4.
%e For n=5, and 5 is the second odd prime [5 = A065091(2)], thus a(5) = 1 + 2*a(2) = 5.
%e For n=9, which is the sixth natural number >= 1 not an odd prime (9 = A065090(6)), we compute 2*a(6-1) = 2*5 = 10.
%e For n=11, which is the fourth odd prime [11 = A065091(4)], we compute 1 + 2*a(4) = 1 + 2*4 = 9, thus a(11) = 9.
%o (Scheme, with memoizing definec-macro)
%o (definec (A257727 n) (cond ((<= n 2) n) ((= 1 (A010051 n)) (+ 1 (* 2 (A257727 (+ -1 (A000720 n)))))) (else (* 2 (A257727 (A062298 n))))))
%Y Inverse: A257728.
%Y Cf. A000720, A010051, A062298, A065090, A065091.
%Y Related or similar permutations: A246377, A246378, A257725, A257730, A257801.
%K nonn
%O 1,2
%A _Antti Karttunen_, May 09 2015