A245704 Permutation of natural numbers: a(1) = 1, a(A014580(n)) = A000040(a(n)), a(A091242(n)) = A002808(a(n)), where A000040(n) = n-th prime, A002808(n) = n-th composite number, and A014580(n) and A091242(n) are binary codes for n-th irreducible and n-th reducible polynomial over GF(2), respectively.
1, 2, 3, 4, 6, 8, 5, 9, 12, 15, 7, 10, 13, 16, 21, 25, 14, 18, 19, 22, 26, 33, 38, 24, 11, 28, 30, 34, 39, 49, 23, 55, 36, 20, 42, 45, 37, 50, 56, 69, 47, 35, 77, 52, 32, 60, 17, 64, 54, 70, 78, 94, 66, 51, 29, 105, 74, 48, 41, 84, 53, 27, 88, 76, 95, 106, 73, 125, 91, 72, 44, 140, 97, 100, 68, 58, 115, 75, 40
Offset: 1
Keywords
Links
Crossrefs
Programs
-
PARI
allocatemem(123456789); default(primelimit, 2^22) A091226 = vector(2^22); A002808(n)={ my(k=-1); while( -n + n += -k + k=primepi(n), ); n}; \\ This function from M. F. Hasler isA014580(n)=polisirreducible(Pol(binary(n))*Mod(1, 2)); \\ This function from Charles R Greathouse IV j=0; n=2; while((n < 2^22), if(isA014580(n), A091226[n] = A091226[n-1]+1, A091226[n] = A091226[n-1]); n++) A091245(n) = ((n-A091226[n])-1); A245704(n) = if(1==n, 1, if(isA014580(n), prime(A245704(A091226[n])), A002808(A245704(A091245(n))))); for(n=1, 10001, write("b245704.txt", n, " ", A245704(n)));
-
Scheme
;; With memoization-macro definec. (definec (A245704 n) (cond ((= 1 n) n) ((= 1 (A091225 n)) (A000040 (A245704 (A091226 n)))) (else (A002808 (A245704 (A091245 n))))))
Formula
a(1) = 1, after which, if A091225(n) is 1 [i.e. n is in A014580], then a(n) = A000040(a(A091226(n))), otherwise a(n) = A002808(a(A091245(n))).
As a composition of related permutations:
Other identities. For all n >= 1, the following holds:
Comments