login
Least numbers k such that k*2^n+1 is a square.
2

%I #16 Jun 18 2017 02:24:19

%S 3,4,2,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,

%T 65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,

%U 33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295

%N Least numbers k such that k*2^n+1 is a square.

%C Excluding a(1) and a(2), these numbers equal 2^n-1 (See A000225).

%C The sequence A088041 is the square roots of the squares produced.

%H Vincenzo Librandi, <a href="/A239678/b239678.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2).

%F a(n+2) == A000225(n) for n >= 1.

%F a(n) = 3*a(n-1)-2*a(n-2) for n>4. G.f.: (4*x^4+3*x^3-4*x^2-5*x+3) / ((x-1)*(2*x-1)). - _Colin Barker_, Mar 24 2014

%e 1*2^1+1 = 3 is not a square. 2*2^1+1 = 5 is not a square. 3*2^1+1 = 7 is not a square. 4*2^1+1 = 9 is a square. Thus, a(1) = 4.

%t CoefficientList[Series[(4 x^4 + 3 x^3 - 4 x^2 - 5 x + 3)/((x - 1) (2 x - 1)), {x, 0, 50}], x] (* _Vincenzo Librandi_, Mar 24 2014 *)

%o (Python)

%o import sympy

%o from sympy import isprime

%o def TwoSq(n):

%o ..for k in range(1,10**10):

%o ....for i in range(10**4):

%o ......if k*(2**n)+1 == i**2:

%o ........return k

%o ......if k*(2**n)+1 < i**2:

%o ........break

%o n = 1

%o while n < 100:

%o ..print(TwoSq(n))

%o ..n += 1

%o (PARI)

%o Vec((4*x^4+3*x^3-4*x^2-5*x+3)/((x-1)*(2*x-1)) + O(x^100)) \\ _Colin Barker_, Mar 24 2014

%Y Cf. A088041, A000225.

%K nonn,easy

%O 0,1

%A _Derek Orr_, Mar 23 2014