OFFSET
1,1
COMMENTS
For n >= 2, note that when k < 5*10^(n-1) we have (k + 1)^2 - k^2 = 2*k + 1 < 10^n, so a(n) >= 5*10^(n-1). For 0 <= t < sqrt(10^n), floor((5*10^(n-1) + t)^2/10^n) = 25*10^(n-2) + t; for t = ceiling(sqrt(10^n)), floor((5*10^(n-1) + t)^2/10^n) = 25*10^(n-2) + t + 1. Take n = 3 as an example. When k < 500, (k + 1)^2 - k^2 < 1000, so a(3) >= 500. Since 31^2 = 961 < 1000, 32^2 = 1024 > 1000, (500 + t)^2 is successively 251001, 252004, ..., 281961, 283024, so a(3) = 500 + 31 = 531.
FORMULA
a(n) = 5*10^(n-1) + ceiling(10^(n/2)) - 1 for n >= 2.
EXAMPLE
floor(7^2/10) = 4, floor(8^2/10) = 6, and 7 is the smallest k such that floor((k + 1)^2/10) - floor(k^2/10) = 2, so a(1) = 7.
floor(59^2/10) = 34, floor(60^2/10) = 36, and 59 is the smallest k such that floor((k + 1)^2/100) - floor(k^2/100) = 2, so a(2) = 59.
PROG
(PARI) a(n) = if(n==1, 7, 5*10^(n-1) + ceil(10^(n/2)) - 1)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, Dec 22 2018
STATUS
approved