login
Permutation of natural numbers induced when A245822 is restricted to nonprime numbers: a(n) = A062298(A245822(A018252(n))).
5

%I #15 Apr 01 2017 21:12:07

%S 1,2,4,5,3,10,6,22,7,16,9,23,27,51,15,17,35,13,37,11,39,56,69,38,14,

%T 18,48,78,33,120,20,19,46,67,24,62,42,34,28,73,25,103,31,206,40,55,68,

%U 92,300,26,76,50,99,65,157,281,165,184,8,121,134,277,423,30,47,36,223,70,514,75,101,116,236,139,74

%N Permutation of natural numbers induced when A245822 is restricted to nonprime numbers: a(n) = A062298(A245822(A018252(n))).

%C This permutation is induced when A245822 is restricted to nonprimes, A018252, the first column of A114537, but equally, when it is restricted to column 2 (A007821), column 3 (A049078), etc. of that square array, or alternatively, to the successive rows of A236542.

%C The sequence of fixed points f(n) begins as 1, 2, 15, 142, 548, 1694, 54681. A018252(f(n)) gives the nonprime terms of A245823.

%H Antti Karttunen, <a href="/A245816/b245816.txt">Table of n, a(n) for n = 1..10001</a>

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

%F a(n) = A062298(A245822(A018252(n))).

%F As a composition of related permutations:

%F a(n) = A245820(A245814(n)).

%F Also following holds for all n >= 1:

%F a(n) = A062298(A049084(A245822(A007821(n)))).

%F a(n) = A062298(A049084(A049084(A245822(A049078(n))))).

%F etc.

%o (PARI)

%o allocatemem(123456789);

%o default(primelimit, 2^22)

%o A014580 = vector(2^18);

%o A091226 = vector(2^22);

%o A002808(n)={my(k); for(k=0, primepi(n), isprime(n++)&&k--); n}; \\ This function from _M. F. Hasler_, Oct 31 2008

%o A062298(n) = n-primepi(n);

%o A018252(n) = if(1==n,1,A002808(n-1));

%o isA014580(n)=polisirreducible(Pol(binary(n))*Mod(1, 2)); \\ This function from _Charles R Greathouse IV_

%o i=0; j=0; n=2; while((n < 2^22), if(isA014580(n), i++; A014580[i] = n; A091226[n] = A091226[n-1]+1, A091226[n] = A091226[n-1]); n++)

%o A091204(n) = if(n<=1, n, if(isprime(n), A014580[A091204(primepi(n))], {my(pfs,t,bits,i); pfs=factor(n); pfs[, 1]=apply(t->Pol(binary(A091204(t))), pfs[, 1]); sum(i=1, #bits=Vec(factorback(pfs))%2, bits[i]<<(#bits-i))}));

%o A091245(n) = ((n-A091226[n])-1);

%o A245704(n) = if(1==n, 1, if(isA014580(n), prime(A245704(A091226[n])), A002808(A245704(A091245(n)))));

%o A245822(n) = A245704(A091204(n));

%o A245816(n) = A062298(A245822(A018252(n)));

%o for(n=1, 10001, write("b245816.txt", n, " ", A245816(n)));

%o (Scheme) (define (A245816 n) (A062298 (A245822 (A018252 n))))

%Y Inverse: A245815.

%Y Related permutations: A245814, A245820, A245822.

%Y Cf. A007821, A018252, A049078, A062298, A114537, A236542, A245823.

%K nonn

%O 1,2

%A _Antti Karttunen_, Aug 02 2014