login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A167482
a(n)=n-1 if n is prime, otherwise a(n)=n+1.
3
2, 1, 2, 5, 4, 7, 6, 9, 10, 11, 10, 13, 12, 15, 16, 17, 16, 19, 18, 21, 22, 23, 22, 25, 26, 27, 28, 29, 28, 31, 30, 33, 34, 35, 36, 37, 36, 39, 40, 41, 40, 43, 42, 45, 46, 47, 46, 49, 50, 51, 52, 53, 52, 55, 56, 57, 58, 59, 58, 61, 60, 63, 64, 65, 66, 67, 66, 69, 70, 71, 70, 73
OFFSET
1,1
MATHEMATICA
Table[If[PrimeQ[n], n-1, n+1], {n, 1, 200}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Nov 04 2009
STATUS
approved