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.
%I A007510 M2130 #85 May 11 2023 10:26:50 %S A007510 2,23,37,47,53,67,79,83,89,97,113,127,131,157,163,167,173,211,223,233, %T A007510 251,257,263,277,293,307,317,331,337,353,359,367,373,379,383,389,397, %U A007510 401,409,439,443,449,457,467,479,487,491,499,503,509,541,547,557,563 %N A007510 Single (or isolated or non-twin) primes: Primes p such that neither p-2 nor p+2 is prime. %C A007510 Almost all primes are a member of this sequence by Brun's theorem. %C A007510 A010051(a(n))*(1-A164292(a(n))) = 0; complement of A001097 with respect to A000040. - _Reinhard Zumkeller_, Mar 31 2010 %D A007510 Richard L. Francis, "Isolated Primes", J. Rec. Math., 11 (1978), 17-22. %D A007510 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A007510 T. D. Noe, <a href="/A007510/b007510.txt">Table of n, a(n) for n = 1..10000</a> %H A007510 Jens Kruse Andersen, Paul Underwood and Pierre Cami, <a href="/A007510/a007510.txt">Chen prime with 70301 digits</a>, digest of 3 messages in primeform Yahoo group, Oct 7, 2005. %H A007510 Jens Kruse Andersen, <a href="http://www.worldofnumbers.com/YPFM6481.htm">Yahoo Primeform Group Message 6481 dd. Oct 7, 2005</a>, reconstruction in html. %H A007510 Ernest G. Hibbs, <a href="https://www.proquest.com/openview/4012f0286b785cd732c78eb0fc6fce80">Component Interactions of the Prime Numbers</a>, Ph. D. Thesis, Capitol Technology Univ. (2022), see p. 33. %H A007510 Omar E. Pol, <a href="http://www.polprimos.com">Determinacion geometrica de los numeros primos y perfectos</a>. %H A007510 Wikipedia, <a href="http://en.wikipedia.org/wiki/Isolated_prime">Isolated prime</a> %F A007510 A010051(a(n)-2) + A010051(a(n)+2) = 0, n > 2. - _Reinhard Zumkeller_, Sep 16 2014 %F A007510 a(n) = prime(A176656(n)). - _R. J. Mathar_, Feb 19 2017 %F A007510 a(n) ~ n log n. - _Charles R Greathouse IV_, Aug 21 2017 %e A007510 All primes congruent to 7 mod 15 are members, except for 7. All terms of A102723 are members, except for 5. - _Jonathan Sondow_, Oct 27 2017 %p A007510 with(numtheory): for i from 1 to 150 do p:=ithprime(i): if(not isprime(p+2) and not isprime(p-2)) then printf("%d, ",p) fi od: # Pab Ter %p A007510 isA007510 := proc(n) isprime(n) and not isprime(n+2) and not isprime(n-2) ; simplify(%) ; end proc: %p A007510 A007510 := proc(n) if n = 1 then 2; else for a from procname(n-1)+1 do if isA007510(a) then return a; end if; end do; end if; end proc: # _R. J. Mathar_, Apr 26 2010 %t A007510 Transpose[Select[Partition[Prime[Range[100]], 3, 1], #[[2]] - #[[1]] != 2 && #[[3]] - #[[2]] != 2 &]][[2]] (* _Harvey P. Dale_, Mar 01 2001 *) %t A007510 Select[Prime[Range[4,100]],!PrimeQ[ #-2]&&!PrimeQ[ #+2]&] (* _Zak Seidov_, May 07 2007 *) %t A007510 Select[Prime[Range[150]],NoneTrue[#+{2,-2},PrimeQ]&] (* _Harvey P. Dale_, Dec 26 2022 *) %o A007510 (UBASIC) 10 'primes using counters 20 N=3:print "2 ";:print "3 ";:C=2 30 A=3:S=sqrt(N) 40 B=N\A 50 if B*A=N then 55 55 Q=N+2:R=N-2: if Q<>prmdiv(Q) and N=prmdiv(N) and R<>prmdiv(R) then print Q;N;R;"-";:stop:else N=N+2:goto 30 60 A=A+2 70 if A<=sqrt(N) then 40:stop 81 C=C+1 100 N=N+2:goto 30 ' _Enoch Haga_, Oct 08 2007 %o A007510 (PARI) forprime(x=2,1000,if(!isprime(x-2)&&!isprime(x+2),print(x))) \\ _Zak Seidov_, Mar 23 2009 %o A007510 (PARI) list(lim)=my(v=List([2]),p=3,q=5); forprime(r=7,lim, if(q-p>2 && r-q>2, listput(v,q)); p=q; q=r); p=precprime(lim); if(p<=lim && p-precprime(p-2)>2 && nextprime(p+2)-p>2, listput(v,p)); Vec(v) \\ _Charles R Greathouse IV_, Aug 21 2017 %o A007510 (Magma) [p: p in PrimesUpTo(1000)| not IsPrime(p-2) and not IsPrime(p+2)]; // _Vincenzo Librandi_, Jun 20 2014 %o A007510 (Haskell) %o A007510 import Data.List (elemIndices) %o A007510 a007510 n = a007510_list !! (n-1) %o A007510 a007510_list = map (+ 1) $ elemIndices (0, 1, 0) $ %o A007510 zip3 (drop 2 a010051_list) a010051_list (0 : 0 : a010051_list) %o A007510 -- _Reinhard Zumkeller_, Sep 16 2014 %o A007510 (Python) %o A007510 from sympy import nextprime %o A007510 def aupto(limit): %o A007510 n, p, q = 1, 2, 3 %o A007510 alst, non_twins, twins = [], [2], [3] %o A007510 while True: %o A007510 p, q = q, nextprime(q) %o A007510 if q - p == 2: %o A007510 if p != twins[-1]: twins.append(p) %o A007510 twins.append(q) %o A007510 else: %o A007510 if p != twins[-1]: non_twins.append(p) %o A007510 if q > limit: return non_twins %o A007510 print(aupto(563)) # _Michael S. Branicky_, Feb 23 2021 %Y A007510 Cf. A083370, A124582, A134099, A134100, A134101, A010051, A102723. %K A007510 nonn,easy,nice %O A007510 1,1 %A A007510 _N. J. A. Sloane_, _Robert G. Wilson v_ %E A007510 More terms from Pab Ter (pabrlos2(AT)yahoo.com), Nov 11 2005