OFFSET
1,6
COMMENTS
a(n)>=1 because there is always at least one square between p and 2p.
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn,easy
AUTHOR
Giovanni Teofilatto, Apr 14 2005
EXTENSIONS
Edited and extended by Ray Chandler, Apr 16 2005
STATUS
approved