cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A260933 Lexicographically smallest permutation of the natural numbers, such that a(n)+n and a(n)+n+1 are both composite numbers.

This page as a plain text file.
%I A260933 #12 Jul 07 2021 16:26:01
%S A260933 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,
%T A260933 27,26,33,32,31,30,29,34,39,38,37,36,35,40,43,42,41,46,45,44,47,50,49,
%U A260933 48,53,52,51,56,55,54,57,58,59,60,61,62,65,64,63,66,67
%N A260933 Lexicographically smallest permutation of the natural numbers, such that a(n)+n and a(n)+n+1 are both composite numbers.
%C A260933 The permutation is self-inverse: a(a(n)) = n.
%H A260933 Reinhard Zumkeller, <a href="/A260933/b260933.txt">Table of n, a(n) for n = 1..10000</a>
%H A260933 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A260933 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 *)
%o A260933 (Haskell)
%o A260933 import Data.List (delete)
%o A260933 a260933 n = a260933_list !! (n-1)
%o A260933 a260933_list = f 1 [1..] where
%o A260933    f x zs = g zs where
%o A260933      g (y:ys) = if a010051' (x + y) == 0 && a010051' (x + y + 1) == 0
%o A260933                    then y : f (x + 1) (delete y zs) else g ys
%o A260933 (Python)
%o A260933 from sympy import isprime
%o A260933 def composite(n): return n > 1 and not isprime(n)
%o A260933 def aupton(terms):
%o A260933     alst, aset = [], set()
%o A260933     for n in range(1, terms+1):
%o A260933         an = 1
%o A260933         while True:
%o A260933             while an in aset: an += 1
%o A260933             if composite(an+n) and composite(an+n+1): break
%o A260933             an += 1
%o A260933         alst, aset = alst + [an], aset | {an}
%o A260933     return alst
%o A260933 print(aupton(67)) # _Michael S. Branicky_, Jul 06 2021
%Y A260933 Cf. A010051, A002808, A136798, A260936 (fixed points), A260822.
%K A260933 nonn
%O A260933 1,1
%A A260933 _Reinhard Zumkeller_, Aug 04 2015