OFFSET
1,1
COMMENTS
If we have consecutive numbers, one prime and one nonprime, swap them. So after the initial 2,1,4,3,6,5,8,7 we have "if n is prime, a(n) = n-1; if n+1 is prime, a(n) = n+1, otherwise a(n) = n".
LINKS
Stefano Spezia, Table of n, a(n) for n = 1..10000
MATHEMATICA
a[n_]:=If[PrimeQ[n], n-1, If[PrimeQ[n+1], n+1, n]]; Join[{2, 1, 4, 3, 6, 5, 8, 7}, Array[a, 65, 9]] (* Stefano Spezia, May 05 2023 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Giovanni Teofilatto, Nov 03 2009
EXTENSIONS
Edited by Franklin T. Adams-Watters, Nov 04 2009
42 and 64 inserted by Stefano Spezia, May 05 2023
STATUS
approved