%I #28 Aug 10 2020 01:41:47
%S 7,15,23,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,
%T 131071,262143,524287,1048575,2097151,4194303,8388607,16777215,
%U 33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295,8589934591,17179869183,34359738367,68719476735
%N Odd values of D > 0 for which the generalized Ramanujan-Nagell equation x^2 + D = 2^m has two or more solutions in the positive integers.
%C D = 7 corresponds to Ramanujan-Nagell equation x^2 + 7 = 2^m with its 5 solutions (A038198 for x, A060728 for n, Wikipedia link).
%C If D odd <> 7, R. Apéry proved in 1960 that the equation x^2 + D = 2^m has at most 2 solutions (see links).
%C If D odd > 0, this equation has 2 solutions iff D = 23 or D = 2^k - 1 for some k >= 4 (link Beukers, theorem 2, p. 395).
%C For any solution (x,m), m is bounded by m < 435 + 10 * (log(D) / log(2)) [link Beukers, corollary 1, p. 394]. If D < 2^96, then the bound becomes m < 18 + 2 * (log(D) / log(2)) [link Beukers, corollary 2, p. 395].
%D Richard K. Guy, Unsolved Problems in Theory of Numbers, Springer-Verlag, 2004, D10.
%H R. Apéry, <a href="https://gallica.bnf.fr/ark:/12148/bpt6k760v/f163.image">Sur une équation Diophantienne</a>, C. R. Acad. Sci. Paris Sér. A251 (1960), 1263-1264.
%H R. Apéry, <a href="https://gallica.bnf.fr/ark:/12148/bpt6k760v/f355.image">Sur une équation Diophantienne</a>, C. R. Acad. Sci. Paris Sér. A251 (1960), 1451-1452.
%H Frits Beukers, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa38/aa3844.pdf">On the generalized Ramanujan-Nagell equation, I</a>, Acta arithmetica, XXXVIII, 1980-1981, page 389-410.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Ramanujan%E2%80%93Nagell_equation">Ramanujan-Nagell equation</a>.
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2).
%F From _Colin Barker_, Aug 05 2020: (Start)
%F G.f.: x*(7 - 6*x - 8*x^2 - 8*x^3 + 16*x^4) / ((1 - x)*(1 - 2*x)).
%F a(n) = 3*a(n-1) - 2*a(n-2) for n>5.
%F a(n) = 2^(1+n)-1 for n>3.
%F (End)
%F The two formulas with a(n) are true, according to theorem 2 of Beukers' link. - _Bernard Schott_, Aug 07 2020
%e For these exceptional cases, the corresponding solutions are:
%e D = 7, (x,m) = (1,3), (3,4), (5,5), (11,7), (181,15);
%e D = 23, (x,m) = (3,5), (45,11);
%e D = 2^k -1, k >= 4, (x,m) = (1,k), (2^(k-1) - 1, 2*(k-1)).
%e For k = 4 and D = 15, then 1^2 + 15 = 2^4 = 16, and 7^2 + 15 = 2^6 = 64.
%e Remark: for k = 2 and D = 3, the two possible solutions corresponding to 2^k-1 coincide with (1, 2).
%Y Cf. A000225, A038198, A060728, A247763, A336881.
%K nonn
%O 1,1
%A _Bernard Schott_, Aug 04 2020