OFFSET
1,2
COMMENTS
Involution (self-inverse permutation) of [positive] natural numbers.
LINKS
FORMULA
a(1) = 1 and a(n) = if n is prime then A002808(A049084(n)) else A000040(A066246(n)) for n>1. - Reinhard Zumkeller, Dec 13 2001
MATHEMATICA
Composite[n_Integer] := FixedPoint[n + PrimePi@# + 1 &, n + PrimePi@n + 1]; f[1] = 1; f[n_] := If[ PrimeQ@n, Composite@ PrimePi@n, Prime[n - 1 - PrimePi@n]]; Array[f, 65] (* Robert G. Wilson v, Jun 08 2010 *)
PROG
(Haskell)
a026239 1 = 1
a026239 n | a010051 n == 1 = a002808 $ a049084 n
| otherwise = a000040 $ a066246 n
-- Reinhard Zumkeller, Mar 30 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Robert G. Wilson v, Jun 08 2010
STATUS
approved