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.

A361690 Number of primes in the interval [2^n, 2^n + n].

This page as a plain text file.
%I A361690 #31 Mar 27 2023 11:48:43
%S A361690 0,2,1,1,2,1,1,1,2,1,2,1,1,0,0,3,4,0,3,0,2,1,1,3,0,0,1,0,2,1,5,1,1,2,
%T A361690 1,0,1,2,2,2,2,1,1,2,3,0,1,3,1,0,0,1,2,2,0,3,0,2,0,0,1,3,0,1,3,0,1,2,
%U A361690 3,1,2,2,1,1,2,3,2,4,2,2,1,2,4,1,3,0,3,2,1,2,0
%N A361690 Number of primes in the interval [2^n, 2^n + n].
%H A361690 Alois P. Heinz, <a href="/A361690/b361690.txt">Table of n, a(n) for n = 0..1000</a>
%F A361690 From _Alois P. Heinz_, Mar 20 2023: (Start)
%F A361690 a(n) = pi(2^n+n) - pi(2^n-1), pi = A000720.
%F A361690 a(n) = A143537(2^n+n,2^n-1). (End)
%e A361690 In the interval [2^1, 2^1 + 1] there are 2 primes (2 and 3). So a(1) = 2.
%p A361690 a:= n-> nops(select(isprime, [$2^n..2^n+n])):
%p A361690 seq(a(n), n=0..100);  # _Alois P. Heinz_, Mar 20 2023
%t A361690 Array[PrimePi[2^# + #] - PrimePi[2^# - 1] &, 50, 0] (* _Michael De Vlieger_, Mar 27 2023 *)
%o A361690 (PARI) a(n)=#primes([2^n,2^n+n])
%o A361690 (Python)
%o A361690 from sympy import isprime
%o A361690 def A361690(n): return sum(1 for p in range((1<<n)+1,(1<<n)+n+1,2) if isprime(p)) if n != 1 else 2 # _Chai Wah Wu_, Mar 27 2023
%Y A361690 Cf. A000720, A036378, A143537.
%K A361690 nonn
%O A361690 0,2
%A A361690 _Jean-Marc Rebert_, Mar 20 2023