OFFSET
1,2
COMMENTS
LINKS
Bert Dobbelaere, Table of n, a(n) for n = 1..104
Wikipedia, Sum-free sequence
FORMULA
a(n) = 2 * a(n-12) for n > 25 (conjectured).
EXAMPLE
The smallest number > 0 that is not in the sequence is 15, because
15^4 = 4^4 + 6^4 + 8^4 + 9^4 + 14^4.
PROG
(Python)
def findSum(nopt, tgt, a, smax, pwr):
if nopt==0:
return [] if tgt==0 else None
if tgt<0 or tgt>smax[nopt-1]:
return None
rv=findSum(nopt-1, tgt - a[nopt-1]**pwr, a, smax, pwr)
if rv!=None:
rv.append(a[nopt-1])
else:
rv=findSum(nopt-1, tgt, a, smax, pwr)
return rv
def A321291(n):
POWER=4 ; x=0 ; a=[] ; smax=[] ; sumpwr=0
while len(a)<n:
while True:
x+=1
lst=findSum(len(a), x**POWER, a, smax, POWER)
if lst==None:
break
rhs = " + ".join(["%d^%d"%(i, POWER) for i in lst])
print(" %d^%d = %s"%(x, POWER, rhs))
a.append(x) ; sumpwr+=x**POWER
print("a(%d) = %d"%(len(a), x))
smax.append(sumpwr)
return a[-1]
CROSSREFS
KEYWORD
nonn
AUTHOR
Bert Dobbelaere, Nov 02 2018
STATUS
approved