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.

A090405 a(n) = PrimePi(n+2) - PrimePi(n).

This page as a plain text file.
%I A090405 #29 Feb 16 2025 08:32:51
%S A090405 2,1,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
%T A090405 1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,
%U A090405 1,1,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,1
%N A090405 a(n) = PrimePi(n+2) - PrimePi(n).
%C A090405 For n>1, a(n) = 1 if n+1 or n+2 is prime, otherwise a(n) = 0. - _Robert Israel_, Mar 30 2017
%H A090405 G. C. Greubel, <a href="/A090405/b090405.txt">Table of n, a(n) for n = 1..1000</a>
%H A090405 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Hardy-LittlewoodConjectures.html">Hardy-Littlewood Conjectures</a>
%p A090405 with(numtheory): A090405:=n->pi(n+2)-pi(n): seq(A090405(n), n=1..150); # _Wesley Ivan Hurt_, Mar 30 2017
%t A090405 Table[Subtract @@ Map[PrimePi, n + {2, 0}], {n, 120}] (* or *)
%t A090405 Table[Boole@ PrimeQ[n + 1 + Boole[OddQ@ n]] + Boole[n == 1], {n, 120}] (* _Michael De Vlieger_, Mar 30 2017 *)
%o A090405 (PARI) for(n=1, 100, print1(primepi(n + 2) - primepi(n),", ")) \\ _Indranil Ghosh_, Mar 31 2017
%o A090405 (Python)
%o A090405 from sympy import primepi
%o A090405 print([primepi(n + 2) - primepi(n) for n in range(1, 101)])
%o A090405 # _Indranil Ghosh_, Mar 31 2017
%o A090405 (Python)
%o A090405 from sympy import isprime
%o A090405 def a(n):
%o A090405     if n<2: return 2
%o A090405     else:
%o A090405         if isprime(n + 1 + (n%2 == 1) + (n==1)): return 1
%o A090405         else: return 0 # _Indranil Ghosh_, Mar 31 2017
%Y A090405 Cf. A000720, A080545, A090406.
%K A090405 nonn,easy
%O A090405 1,1
%A A090405 _Eric W. Weisstein_, Nov 29 2003