OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..10000
EXAMPLE
Start with sequence of positive integers, then swap a(i) and a(i+1) if a(i) is an odd prime:
a(1)=1, a(2)=2, then a(3)=4 and a(4)=3 because p=3 is odd prime and p and p+1 are swapped.
MAPLE
f:= proc(n) if isprime(2*n+1) then (2*n+2, 2*n+1) else (2*n+1, 2*n+2) fi end proc:
map(f, [$0..100]); # Robert Israel, Nov 07 2016
MATHEMATICA
r=Range[100]; Do[If[PrimeQ[r[[i]]], {r[[i]], r[[i+1]]}={r[[i+1]], r[[i]]}], {i, 3, 97, 2}]; r
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Nov 27 2007
STATUS
approved