OFFSET
1,1
COMMENTS
The permutation is self-inverse: a(a(n)) = n.
LINKS
MATHEMATICA
a[n_]:=a[n]=(k=1; While[PrimeQ[k+n]||PrimeQ[k+n+1]||MemberQ[Array[a, n-1], k], k++]; k); Array[a, 100] (* Giorgos Kalogeropoulos, Jul 06 2021 *)
PROG
(Haskell)
import Data.List (delete)
a260933 n = a260933_list !! (n-1)
a260933_list = f 1 [1..] where
f x zs = g zs where
g (y:ys) = if a010051' (x + y) == 0 && a010051' (x + y + 1) == 0
then y : f (x + 1) (delete y zs) else g ys
(Python)
from sympy import isprime
def composite(n): return n > 1 and not isprime(n)
def aupton(terms):
alst, aset = [], set()
for n in range(1, terms+1):
an = 1
while True:
while an in aset: an += 1
if composite(an+n) and composite(an+n+1): break
an += 1
alst, aset = alst + [an], aset | {an}
return alst
print(aupton(67)) # Michael S. Branicky, Jul 06 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 04 2015
STATUS
approved