login
Triangular numbers representable as 2^x + 3^y.
1

%I #17 Mar 11 2021 05:13:17

%S 3,10,28,91

%N Triangular numbers representable as 2^x + 3^y.

%C No other terms such that 0 <= x,y < 2000.

%C No other terms such that 0 <= x,y < 5250. - _Michael S. Branicky_, Mar 10 2021

%e a(1) = 3 = 2^1 + 3^0.

%e a(4) = 91 = 2^6 + 3^3.

%o (PARI) isok(t) = {for (k=0, logint(t, 2), my(tt = t - 2^k); if (tt, p = valuation(tt, 3); if (tt == 3^p, return(1))););}

%o lista(nn) = for (n=1, nn, if (isok(t=n*(n+1)/2), print1(t, ", "))); \\ _Michel Marcus_, Sep 20 2015

%o (PARI) select(x->ispolygonal(x, 3), setbinop(f, [0..20], [0..20])) \\ _Michel Marcus_, Mar 10 2021

%o (Python)

%o from sympy import integer_nthroot

%o def auptoexponent(maxexp):

%o sums = set(2**x + 3**y for x in range(maxexp) for y in range(maxexp))

%o iroots = set(integer_nthroot(2*s, 2)[0] for s in sums)

%o return sorted(set(r*(r+1)//2 for r in iroots if r*(r+1)//2 in sums))

%o print(auptoexponent(500)) # _Michael S. Branicky_, Mar 10 2021

%Y Cf. A225390, A226499, A227027, A259745, A259746, A262242.

%Y Intersection of A000217 and A004050.

%K nonn,more

%O 1,1

%A _Alex Ratushnyak_, Sep 16 2015