OFFSET
1,2
COMMENTS
For n > 1, a(n) is never zero. Proof: R(2) = 4*2+3, R(3) = 4*27+3. In general 111...1 = 4*2777...7+3, or if f(n) = 2777...7 = (7/9)*(-1 + 10^n) + 2^(n+1)*5^n, then R(n) = 4*f(n-2) + 3. Hence repunits are of the form 4m+3 and cannot be square. [Paraphrased from Tattersall]
REFERENCES
J. Tattersall, "Elementary Number Theory in Nine Chapters". Cambridge University Press, 2001. pp. 57, 330.
FORMULA
a(n) = ceiling(sqrt(R(n)))^2 - R(n).
EXAMPLE
a(5) = 125 because 11111 + 125 = 11236 is a square.
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jason Earls, Jun 09 2003
STATUS
approved