login
Integers n where n^3 + (n+1)^3 is a Taxicab number A001235.
2

%I #97 Jan 11 2016 20:59:02

%S 9,121,235,301,1090,1293,1524,3152,8010,15556,15934,19247,20244,21498,

%T 24015,25363,25556,45462,57872,63758,80016,93349,94701,101929,113098,

%U 119942,132414,143653,167147,186540,192629,229508,246122,247318,292154,307534,322870

%N Integers n where n^3 + (n+1)^3 is a Taxicab number A001235.

%H David Rabahy and Alois P. Heinz and Chai Wah Wu, <a href="/A259836/b259836.txt">Table of n, a(n) for n = 1..90</a> (first 38 terms from David Rabahy, next 12 terms from Alois P. Heinz)

%e 9^3 + 10^3 = 1729 = A001235(1), so 9 is in the sequence.

%p filter:= proc(n)

%p local D, b, a, Q;

%p D:= numtheory:-divisors(n);

%p for b in D do

%p a:= n/b;

%p Q:= 12*b - 3*a^2;

%p if Q > 9 and issqr(Q) and Q < 9*a^2 then return true fi

%p od;

%p false

%p end proc:

%p select(x -> filter(x^3 +(x+1)^3), [$1..100000]); # _Robert Israel_, Jul 07 2015

%t Select[Range[10000], Length[PowersRepresentations[#^3 + (# + 1)^3, 2, 3]]==2 &] (* _Vincenzo Librandi_, Jul 10 2015 *)

%o (Python 3.x)

%o start = 9

%o end = 500000

%o print(start,end)

%o cubes = []

%o t = end**3+(end+1)**3

%o max = int(t**(1/3)+.5)

%o for i in range(0,max+1):

%o cubes.append(i**3)

%o for x in range(start,end):

%o t = cubes[x]+cubes[x+1]

%o for i in range(1,x):

%o z = t-cubes[i]

%o n = int(z**(1/3)+.5)

%o if cubes[n] == z:

%o print(x,x+1,i,n,'\a')

%o (Python)

%o from __future__ import division

%o from gmpy2 import is_square

%o from sympy import divisors

%o A259836_list = []

%o for n in range(10000):

%o m = n**3+(n+1)**3

%o for x in divisors(m):

%o x2 = x**2

%o if x2 > m:

%o break

%o if x != (2*n+1) and m < x*x2 and is_square(12*m//x-3*x2):

%o A259836_list.append(n)

%o break # _Chai Wah Wu_, Jan 10 2016

%Y Cf. A001235, A005898.

%K nonn

%O 1,1

%A _David Rabahy_, Jul 06 2015