OFFSET
1,2
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
A. B. Frizell, Certain non-enumerable sets of infinite permutations. Bull. Amer. Math. Soc. 21 (1915), no. 10, 495-499.
MATHEMATICA
a253046[n_] := Block[{f},
f[x_] := Which[PrimeQ[x/2], 3 NextPrime[x/2],
PrimeQ[x/3], 2 NextPrime[x/3, -1],
True, x]; Array[f, n]]; a253046[67] (* Michael De Vlieger, Dec 27 2014 *)
PROG
(Haskell)
a253046 n | i == 0 || p > 3 = n
| p == 2 = 3 * a000040 (i + 1)
| otherwise = 2 * a000040 (i - 1)
where i = a049084 (div n p); p = a020639 n
-- Reinhard Zumkeller, Dec 26 2014
(Python)
from sympy import isprime, nextprime, prevprime
def A253046(n):
....q2, r2 = divmod(n, 2)
....if not r2 and isprime(q2):
........return 3*nextprime(q2)
....else:
........q3, r3 = divmod(n, 3)
........if not r3 and isprime(q3):
............return 2*prevprime(q3)
........return n # Chai Wah Wu, Dec 27 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Dec 26 2014
STATUS
approved