OFFSET
1,2
COMMENTS
This sequence is a self-inverse permutation of the positive integers that preserves the number of prime divisors (with or without multiplicity).
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Annotated log-log plot of a(n), n = 1..2^14, showing records in red, local minima in blue, highlighting primes in green, fixed points in gold, and composite prime powers in magenta.
FORMULA
a(prime(2*n)) = prime(2*n-1) (where prime(n) denotes the n-th prime number).
EXAMPLE
The first terms are:
n a(n) g=gcd(n, a(n)) n/g a(n)/g
-- ---- -------------- --- ------
1 1 1 1 1
2 3 1 2 3
3 2 1 3 2
4 6 2 2 3
5 7 1 5 7
6 4 2 3 2
7 5 1 7 5
8 12 4 2 3
9 15 3 3 5
10 14 2 5 7
11 13 1 11 13
12 8 4 3 2
13 11 1 13 11
14 10 2 7 5
MATHEMATICA
nn = 120; c[_] = 0; a[1] = c[1] = 1; u = 2; Do[k = u; While[Nand[c[k] == 0, AllTrue[{i/#, k/#}, PrimeQ] &@ GCD[i, k]], k++]; Set[{a[i], c[k]}, {k, i}]; If[k == u, While[c[u] > 0, u++]], {i, 2, nn}]; Array[a, nn] (* Michael De Vlieger, May 22 2022 *)
PROG
(PARI) s=0; for (n=1, 67, for (v=1, oo, if (!bittest(s, v) && (n==1 || (isprime(n/g=gcd(n, v)) && isprime(v/g))), print1 (v", "); s+=2^v; break)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, May 20 2022
STATUS
approved