login
A105223
Number of squares between prime(n) and 2*prime(n) inclusive.
2
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, 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, 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
OFFSET
1,6
COMMENTS
a(n)>=1 because there is always at least one square between p and 2p.
LINKS
FORMULA
a(n) = A000196(2*prime(n)) - A000196(prime(n)-1).
EXAMPLE
a(6)=2 because between 13 and 2*13 there are two squares: 4^2 and 5^2.
MATHEMATICA
f[n_] := Floor[Sqrt[n]]; Table[f[2Prime[n]] - f[Prime[n] - 1], {n, 100}]
PROG
(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
(Python)
from math import isqrt
from sympy import prime, primerange
def aupton(terms):
return [isqrt(2*p) - isqrt(p-1) for p in primerange(1, prime(terms)+1)]
print(aupton(103)) # Michael S. Branicky, Jul 22 2021
CROSSREFS
Sequence in context: A350823 A143977 A115265 * A025859 A031281 A203181
KEYWORD
nonn,easy
AUTHOR
Giovanni Teofilatto, Apr 14 2005
EXTENSIONS
Edited and extended by Ray Chandler, Apr 16 2005
STATUS
approved