cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A257727 Permutation of natural numbers: a(1) = 1, a(oddprime(n)) = 1 + 2*a(n), a(not_an_oddprime(n)) = 2*a(n-1).

This page as a plain text file.
%I A257727 #13 May 10 2015 11:00:30
%S A257727 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 A257727 36,30,21,56,25,44,64,34,80,96,19,52,72,60,29,42,23,112,50,88,33,128,
%U A257727 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 A257727 Permutation of natural numbers: a(1) = 1, a(oddprime(n)) = 1 + 2*a(n), a(not_an_oddprime(n)) = 2*a(n-1).
%C A257727 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 A257727 Antti Karttunen, <a href="/A257727/b257727.txt">Table of n, a(n) for n = 1..10000</a>
%H A257727 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A257727 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 A257727 As a composition of other permutations:
%F A257727 a(n) = A246377(A257730(n)).
%F A257727 a(n) = A257725(A257801(n)).
%e A257727 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 A257727 For n=4, which is A065090(3), we compute 2*a(3-1) = 2*2 = 4.
%e A257727 For n=5, and 5 is the second odd prime [5 = A065091(2)], thus a(5) = 1 + 2*a(2) = 5.
%e A257727 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 A257727 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 A257727 (Scheme, with memoizing definec-macro)
%o A257727 (definec (A257727 n) (cond ((<= n 2) n) ((= 1 (A010051 n)) (+ 1 (* 2 (A257727 (+ -1 (A000720 n)))))) (else (* 2 (A257727 (A062298 n))))))
%Y A257727 Inverse: A257728.
%Y A257727 Cf. A000720, A010051, A062298, A065090, A065091.
%Y A257727 Related or similar permutations: A246377, A246378, A257725, A257730, A257801.
%K A257727 nonn
%O A257727 1,2
%A A257727 _Antti Karttunen_, May 09 2015