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.

A266402 Self-inverse permutation of natural numbers: a(n) = A064989(A030101(A003961(n))).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 11, 8, 17, 10, 7, 12, 13, 14, 25, 38, 9, 30, 23, 20, 53, 34, 19, 36, 15, 26, 51, 28, 29, 18, 37, 76, 33, 22, 83, 24, 31, 16, 39, 40, 47, 42, 59, 46, 75, 44, 41, 218, 73, 122, 27, 52, 21, 188, 107, 56, 101, 58, 43, 100, 89, 74, 397, 152, 65, 66, 109, 134, 131, 70, 71, 514, 49, 62, 45, 32, 239, 78, 97, 120, 563, 82, 35
Offset: 1

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Comments

Shift primes in the prime factorization of n one step towards larger primes (A003961), then reverse the binary representation of the resulting odd number (with A030101), which yields another (or same) odd number, then shift primes in the prime factorization of that second odd number one step back towards smaller primes (A064989).

Crossrefs

Cf. A265329, A266404 (other conjugates or similar sequences derived from A057889).
Cf. also A266401, A266415, A266416.

Programs

  • Mathematica
    f[n_] := Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose @FactorInteger@ n; g[n_] := FromDigits[Reverse@ IntegerDigits[n, 2], 2] 2^IntegerExponent[n, 2]; h[p_?PrimeQ] := h[p] = Prime[PrimePi@ p + 1]; h[1] = 1; h[n_] := h[n] = Times @@ (h[First@ #]^Last@ # &) /@ FactorInteger@ n; Table[f@ g@ h@ n, {n, 83}] (* A266402, after Jean-François Alcover at A003961 and Ivan Neretin at A057889 *)
  • PARI
    A030101(n) = if(n<1,0,subst(Polrev(binary(n)),x,2));
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    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)};
    A266402 = n -> A064989(A030101(A003961(n)));
    for(n=1, 8191, write("b266402.txt", n, " ", A266402(n)));
    
  • Scheme
    (define (A266402 n) (A064989 (A057889 (A003961 n))))

Formula

Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]