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
David A. Corneth, Table of n, a(n) for n = 1..10000
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
AUTHOR
Elvar Wang Atlason, Hrólfur Eyjólfsson, Jul 21 2021
STATUS
approved