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!)
A105223 Number of squares between prime(n) and 2*prime(n) inclusive. 2

%I #12 Jul 22 2021 17:40:54

%S 1,1,1,1,1,2,1,2,2,2,2,2,3,3,3,3,3,4,3,3,4,4,3,4,4,4,4,4,4,5,4,5,5,5,

%T 5,5,5,6,6,5,5,6,6,6,5,5,6,7,6,6,6,6,6,7,6,6,7,7,7,7,7,7,7,7,8,8,7,7,

%U 8,8,8,8,8,8,8,8,8,9,8,8,8,9,9,9,9,8,8,9,9,9,9,9,9,9,9,9,9,10,10,9,10,10,10

%N Number of squares between prime(n) and 2*prime(n) inclusive.

%C a(n)>=1 because there is always at least one square between p and 2p.

%H David A. Corneth, <a href="/A105223/b105223.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000196(2*prime(n)) - A000196(prime(n)-1).

%e a(6)=2 because between 13 and 2*13 there are two squares: 4^2 and 5^2.

%t f[n_] := Floor[Sqrt[n]]; Table[f[2Prime[n]] - f[Prime[n] - 1], {n, 100}]

%o (PARI) first(n) = { my(res = vector(n), t = 0); forprime(p = 2, oo, t++; res[t] = sqrtint(2*p)-sqrtint(p-1); if(t >= n, return(res)); ) } \\ _David A. Corneth_, Jul 22 2021

%o (Python)

%o from math import isqrt

%o from sympy import prime, primerange

%o def aupton(terms):

%o return [isqrt(2*p) - isqrt(p-1) for p in primerange(1, prime(terms)+1)]

%o print(aupton(103)) # _Michael S. Branicky_, Jul 22 2021

%Y Cf. A000196, A105224.

%K nonn,easy

%O 1,6

%A _Giovanni Teofilatto_, Apr 14 2005

%E Edited and extended by _Ray Chandler_, Apr 16 2005

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 April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)