login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A260933 Lexicographically smallest permutation of the natural numbers, such that a(n)+n and a(n)+n+1 are both composite numbers. 3
7, 6, 5, 4, 3, 2, 1, 12, 11, 10, 9, 8, 13, 18, 17, 16, 15, 14, 19, 24, 23, 22, 21, 20, 25, 28, 27, 26, 33, 32, 31, 30, 29, 34, 39, 38, 37, 36, 35, 40, 43, 42, 41, 46, 45, 44, 47, 50, 49, 48, 53, 52, 51, 56, 55, 54, 57, 58, 59, 60, 61, 62, 65, 64, 63, 66, 67 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

The permutation is self-inverse: a(a(n)) = n.

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

Index entries for sequences that are permutations of the natural numbers

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

Cf. A010051, A002808, A136798, A260936 (fixed points), A260822.

Sequence in context: A284807 A309909 A031099 * A194755 A333884 A055118

Adjacent sequences: A260930 A260931 A260932 * A260934 A260935 A260936

KEYWORD

nonn

AUTHOR

Reinhard Zumkeller, Aug 04 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 3 04:25 EST 2023. Contains 360024 sequences. (Running on oeis4.)