OFFSET
1,2
COMMENTS
a(n)^2 = A226076(n) forms a sum-free sequence.
LINKS
Bert Dobbelaere, Table of n, a(n) for n = 1..89
Wikipedia, Sum-free sequence
FORMULA
a(n) = 2 * a(n-3) for n > 9 (conjectured).
EXAMPLE
0^2 = 0 (sum of squares of the empty set).
1^2 cannot be written as sum of squares of the empty set, so a(1)=1.
Suppose we determined all terms up to a(7)=12:
13^2 = 12^2 + 4^2 + 3^2,
14^2 = 12^2 + 6^2 + 4^2,
15^2 = 12^2 + 8^2 + 4^2 + 1^2.
16^2 cannot be written as sum of squares of distinct smaller terms, hence a(8)=16.
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 A321266(n):
....POWER=2 ; 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 01 2018
STATUS
approved