login
Permutation of natural numbers: a(n) = A156552(1+A005940(1+n)).
5

%I #7 Jan 02 2023 12:30:54

%S 1,2,3,4,5,8,9,6,7,16,15,32,65,128,35,64,11,10,33,18,27,1024,513,12,

%T 25,130,515,2048,77,36,8193,34,17,256,129,512,71,8192,63,4096,133,

%U 524288,65537,131072,271,72,519,24,262145,70,8195,33554432,16389,34359738368,1073741825,1048576,65543,9007199254740992,131079

%N Permutation of natural numbers: a(n) = A156552(1+A005940(1+n)).

%C Note the indexing: although the domain starts from 0, the range excludes zero.

%H Antti Karttunen, <a href="/A297163/b297163.txt">Table of n, a(n) for n = 0..440</a>

%H David Newman, et al, <a href="http://list.seqfan.eu/oldermail/seqfan/2018-January/018239.html">New sequences from old, Discussion on SeqFan-mailing list</a>, January 2018.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

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

%H <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>

%o (PARI)

%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ Modified from code of _M. F. Hasler_

%o A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};

%o A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n))));

%o A297163(n) = A156552(1+A005940(1+n));

%o (Scheme) (define (A297163 n) (A156552 (+ 1 (A005940 (+ 1 n)))))

%Y Inverse: A297164.

%Y Cf. A005940, A156552.

%Y Cf. also A297165.

%K nonn

%O 0,2

%A _Antti Karttunen_, Jan 05 2018