|
PROG
|
(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))); ); }
lista(nn) = for (n=1, nn, if (isok(t=n*(n+1)/2), print1(t, ", "))); \\ Michel Marcus, Sep 20 2015
(PARI) select(x->ispolygonal(x, 3), setbinop(f, [0..20], [0..20])) \\ Michel Marcus, Mar 10 2021
(Python)
from sympy import integer_nthroot
def auptoexponent(maxexp):
sums = set(2**x + 3**y for x in range(maxexp) for y in range(maxexp))
iroots = set(integer_nthroot(2*s, 2)[0] for s in sums)
return sorted(set(r*(r+1)//2 for r in iroots if r*(r+1)//2 in sums))
|