login
A346522
a(n) is the smallest number such that there are precisely n squares between a(n) and 2*a(n) inclusive.
3
1, 8, 25, 61, 98, 162, 221, 288, 392, 481, 613, 722, 841, 1013, 1152, 1352, 1513, 1741, 1922, 2113, 2381, 2592, 2888, 3121, 3362, 3698, 3961, 4325, 4608, 5000, 5305, 5618, 6050, 6385, 6845, 7200, 7565, 8065, 8450, 8978, 9385, 9800, 10368, 10805, 11401, 11858
OFFSET
1,2
COMMENTS
Smallest index where A105224 takes the value n.
The sequence is increasing, as the number of squares between k and 2k is at most one less than the number of squares between k+1 and 2*(k+1).
Either 2*a(n) - 1 or 2*a(n) is a perfect square. a(n)-1 is not a perfect square. - David A. Corneth, Jul 22 2021 [Edited by Elvar Wang Atlason, Jul 22 2021]
If a(n) is even, then 2*a(n)-1 is not a square by considering mod 4. Then 2*a(n) must be square, so a(n) is itself twice a square. Next, if a(n) is odd, then 2*a(n) is not a square. So 2*a(n)-1 is a square, and then a(n) is a sum of consecutive squares. This also shows that a(n) is expressible as a sum of two squares, and so is a subsequence of A001481. - Elvar Wang Atlason, Jul 25 2021
LINKS
FORMULA
a(n) = ceiling(((floor(2*n-1+sqrt(2)*(n-1)))^2)/2). - Elvar Wang Atlason, Mar 24 2024
EXAMPLE
For n = 3, a(3) = 25 as there are 3 squares between 25 and 50, namely 5^2, 6^2 and 7^2. No number k smaller than 25 has 3 squares between k and 2k inclusive.
MATHEMATICA
a[n_]:=(k=1; While[Floor@Sqrt[2k]-Floor@Sqrt[k-1]!=n, k++]; k); Array[a, 30] (* Giorgos Kalogeropoulos, Jul 22 2021 *)
PROG
(Python)
k = 1
n = 1
while n<100:
if math.isqrt(2*k)-math.isqrt(k-1) == n:
print(k)
n = n+1
k = k+1
(Python)
from itertools import count
from math import isqrt
def A346522(n): return next(filter(lambda k:isqrt(k<<1)-isqrt(k-1)==n, (m**2+1>>1 for m in count(1)))) # Chai Wah Wu, Oct 19 2022
(PARI) a(n) = my(k=1); while (sqrtint(2*k) - sqrtint(k-1) != n, k++); k; \\ Michel Marcus, Jul 22 2021
(PARI) a(n) = n--; (ceil(sqrt(2)*(n/(sqrt(2)-1)))^2 + 1)\2 + (n==0) \\ David A. Corneth, Jul 22 2021
CROSSREFS
KEYWORD
nonn,easy
STATUS
approved