Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #24 Apr 05 2021 13:33:20
%S 0,5,17,45,115,67,2205,2933,166667,44445,245795,6667,132683733,
%T 4444445,2012917,23767083,2680575317,666667,555555555555555555,
%U 83053525,3263104267,12488376483,5555555555555555555555,66666667,2952525627555
%N Find smallest pair (x,y) such that x^2-y^2 = 11...1 (n times) = (10^n-1)/9; sequence gives value of y.
%C Least solutions for 'Difference between two squares is a repunit of length n'.
%D David Wells, "Curious and Interesting Numbers", Revised Ed. 1997, Penguin Books, p. 119. ISBN 0-14-026149-4.
%H H. Havermann, <a href="http://chesswanks.com/pxp/RSD.html">Repunit Square Differences (gives many more terms)</a>
%F a(n) = (A033677((10^n-1)/9)-A033676((10^n-1)/9))/2. - _Chai Wah Wu_, Apr 05 2021
%e For n=2, 6^2 - 5^2 = 11.
%t s = Flatten[Table[r = (10^i - 1)/9; d = Divisors[r]; p = d[[Length[d]/2]]; Solve[{x - y == p, x + y == r/p}, {y, x}], {i, 2, 56}]]; Prepend[Cases[s, Rule[y, n_] -> n], 0]
%t Join[{0},Table[y/.Solve[{x>0,y>0,x^2-y^2==FromDigits[PadRight[{},n,1]]},{x,y},Integers][[1]],{n,2,30}]](* _Harvey P. Dale_, Jun 12 2018 *)
%o (Python)
%o from sympy import divisors
%o def A048612(n):
%o d = divisors((10**n-1)//9)
%o l = len(d)
%o return (d[l//2]-d[(l-1)//2])//2 # _Chai Wah Wu_, Apr 05 2021
%Y Cf. A048611, A000042, A002275, A033676, A033677.
%K nonn,nice
%O 1,2
%A _Felice Russo_
%E Corrected and extended by _Patrick De Geest_, Jun 15 1999
%E More terms from _Hans Havermann_, Jul 02 2000
%E Offset corrected by _Chai Wah Wu_, Apr 05 2021