OFFSET
1,2
FORMULA
a(n) = ceiling(sqrt(n*10^d))^2 - n*10^d, where d = n-digit(n), digit(n) = number of digits in n.
EXAMPLE
a(7) = 7001316 - 7000000 = 1316.
MATHEMATICA
ceil[n_]:=Module[{d=n-IntegerLength[n], c}, c=n*10^d; Ceiling[Sqrt[c]]^2-c]; Array[ceil, 30] (* Harvey P. Dale, Sep 03 2018 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ray Chandler, Aug 11 2003
EXTENSIONS
Edited by Charles R Greathouse IV, Aug 03 2010
STATUS
approved