login
Self-inverse permutation of natural numbers: a(1)=1, a(p_i) = 2^i, and if n = p_i1 * p_i2 * p_i3 * ... * p_{ik-1} * p_ik, where p's are primes, with their indexes are sorted into nondescending order: i1 <= i2 <= i3 <= ... <= i_{k-1} <= ik, then a(n) = 2^(i1-1) * 3^(i2-i1) * 5^(i3-i2) * ... * p_k^(1+(ik-i_{k-1})). Here k = A001222(n) and ik = A061395(n).
54

%I #54 Jul 23 2023 18:24:17

%S 1,2,4,3,8,9,16,5,6,27,32,25,64,81,18,7,128,15,256,125,54,243,512,49,

%T 12,729,10,625,1024,75,2048,11,162,2187,36,35,4096,6561,486,343,8192,

%U 375,16384,3125,50,19683,32768,121,24,45,1458,15625,65536,21,108,2401

%N Self-inverse permutation of natural numbers: a(1)=1, a(p_i) = 2^i, and if n = p_i1 * p_i2 * p_i3 * ... * p_{ik-1} * p_ik, where p's are primes, with their indexes are sorted into nondescending order: i1 <= i2 <= i3 <= ... <= i_{k-1} <= ik, then a(n) = 2^(i1-1) * 3^(i2-i1) * 5^(i3-i2) * ... * p_k^(1+(ik-i_{k-1})). Here k = A001222(n) and ik = A061395(n).

%C This permutation maps between the partitions as ordered in A112798 and A241918 (the original motivation for this sequence).

%C For all n > 2, A007814(a(n)) = A055396(n)-1, which implies that this self-inverse permutation maps between primes (A000040) and the powers of two larger than one (A000079(n>=1)), and apart from a(1) & a(2), this also maps each even number to some odd number, and vice versa, which means there are no fixed points after 2.

%C A122111 commutes with this one, that is, a(n) = A122111(a(A122111(n))).

%C Conjugates between A243051 and A242424 and other rows of A243060 and A243070.

%H Antti Karttunen, <a href="/A241909/b241909.txt">Table of n, a(n) for n = 1..1024</a>

%H A. Karttunen, <a href="/A122111/a122111.txt">A few notes on A122111, A241909 & A241916.</a>

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

%F If n is a prime with index i (p_i), then a(n) = 2^i, otherwise when n = p_i1 * p_i2 * p_i3 * ... p_ik, where p_i1, p_i2, p_i3, ..., p_ik are the primes present (not necessarily all distinct) in the prime factorization of n, sorted into nondescending order, a(n) = 2^(i1-1) * 3^(i2-i1) * 5^(i3-i2) * ... * p_k^(1+(ik-i_{k-1})).

%F Equally, if n = 2^k, then a(n) = p_k, otherwise, when n = 2^e1 * 3^e2 * 5^e3 * ... * p_k^{e_k}, i.e., where e1 ... e_k are the exponents (some of them possibly zero, except the last) of the primes 2, 3, 5, ... in the prime factorization of n, a(n) = p_{1+e1} * p_{1+e1+e2} * p_{1+e1+e2+e3} * ... * p_{e1+e2+e3+...+e_k}.

%F From the equivalence of the above two formulas (which are inverses of each other) it follows that a(a(n)) = n, i.e., that this permutation is an involution. For a proof, please see the attached notes.

%F The first formula corresponds to this recurrence:

%F a(1) = 1, a(p_k) = 2^k for primes with index k, otherwise a(n) = (A000040(A001222(n))^(A241917(n)+1)) * A052126(a(A052126(n))).

%F And the latter formula with this recurrence:

%F a(1) = 1, and for n>1, if n = 2^k, a(n) = A000040(k), otherwise a(n) = A000040(A001511(n)) * A242378(A007814(n), a(A064989(n))).

%F [Here A242378(k,n) changes each prime p(i) in the prime factorization of n to p(i+k), i.e., it's the result of A003961 iterated k times starting from n.]

%F We also have:

%F a(1)=1, and for n>1, a(n) = Product_{i=A203623(n-1)+2..A203623(n)+1} A000040(A241918(i)).

%F For all n >= 1, A001222(a(n)) = A061395(n), and vice versa, A061395(a(n)) = A001222(n).

%F For all n > 1, a(2n-1) = 2*a(A064216(n)).

%e For n = 12 = 2 * 2 * 3 = p_1 * p_1 * p_2, we obtain by the first formula 2^(1-1) * 3^(1-1) * 5^(1+(2-1)) = 5^2 = 25. By the second formula, as n = 2^2 * 3^1, we obtain the same result, p_{1+2} * p_{2+1} = p_3 * p_3 = 25, thus a(12) = 25.

%e Using the product formula over the terms of row n of table A241918, we see, because 9450 = 2*3*3*3*5*5*7 = p_1^1 * p_2^3 * p_3^2 * p_4^1, that the corresponding row in A241918 is {2,5,7,7}, and multiplying p_2 * p_5 * p_7^2 yields 3 * 11 * 17 * 17 = 9537, thus a(9450) = 9537.

%e Similarly, for 9537, the corresponding row in A241918 is {1,2,2,2,3,3,4}, and multiplying p_1^1 * p_2^3 * p_3^2 * p_4^1, we obtain 9450 back.

%t Array[If[# == 1, 1, Function[t, Times @@ Prime@ Accumulate[If[Length@ t < 2, {0}, Join[{1}, ConstantArray[0, Length@ t - 2], {-1}]] + ReplacePart[t, Map[#1 -> #2 & @@ # &, #]]]]@ ConstantArray[0, Transpose[#][[1, -1]]] &[FactorInteger[#] /. {p_, e_} /; p > 0 :> {PrimePi@ p, e}]] &, 56] (* _Michael De Vlieger_, Jan 23 2020 *)

%o (Scheme, with _Antti Karttunen_'s IntSeq-library)

%o (definec (A241909 n) (cond ((<= n 1) n) ((prime? n) (A000079 (A049084 n))) (else (* (A052126 (A241909 (A052126 n))) (expt (A000040 (A001222 n)) (+ 1 (A241917 n)))))))

%o ;; Another recursive version:

%o (definec (A241909 n) (cond ((<= n 2) n) ((pow2? n) (A000040 (A007814 n))) (else (* (A000040 (A001511 n)) (A242378bi (A007814 n) (A241909 (A064989 n))))))) ;; The function A242378bi is given in A242378.

%o (define (pow2? n) (let loop ((n n) (i 0)) (cond ((zero? n) #f) ((odd? n) (and (= 1 n) i)) (else (loop (/ n 2) (1+ i)))))) ;; Gives non-false only when n is a power of two.

%o (Haskell)

%o a241909 1 = 1

%o a241909 n = product $ zipWith (^) a000040_list $ zipWith (-) is (1 : is)

%o where is = reverse ((j + 1) : js)

%o (j:js) = reverse $ map a049084 $ a027746_row n

%o -- _Reinhard Zumkeller_, Aug 04 2014

%o (PARI) A241909(n) = if(1==n||isprime(n),2^primepi(n),my(f=factor(n),h=1,i,m=1,p=1,k=1); while(k<=#f~, p = nextprime(1+p); i = primepi(f[k,1]); m *= p^(i-h); h = i; if(f[k,2]>1, f[k,2]--, k++)); (p*m)); \\ _Antti Karttunen_, Jan 17 2020

%Y Cf. A203623, A241918, A242378, A007814, A064989, A064216, A001222, A061395, A125976, A243060, A243070.

%Y Cf. also A278220 (= A046523(a(n)), A331280 (its rgs_transform), A331299 (= min(n,a(n))).

%Y {A000027, A122111, A241909, A241916} form a 4-group.

%Y Cf. A049084, A027746.

%K nonn

%O 1,2

%A _Antti Karttunen_, May 03 2014, partly inspired by _Marc LeBrun_'s Jan 11 2006 message on SeqFan mailing list.

%E Typos in the name corrected by _Antti Karttunen_, May 31 2014