%I #8 Nov 03 2018 11:52:53
%S 1,2,3,4,5,7,8,10,11,13,17,21,22,28,29,33,38,41,48,68,70,96,124,130,
%T 158,179,239,309,310,351,468,509,640,843,900,1251,1576,1640,2305,2444,
%U 2989,3410,4575,5758,5998,7490,8602,11657,13017,15553,19150,24411,25365
%N Smallest positive number for which the 3rd power cannot be written as sum of 3rd powers of any subset of previous terms.
%C a(n)^3 forms a sum-free sequence.
%H Bert Dobbelaere, <a href="/A321290/b321290.txt">Table of n, a(n) for n = 1..100</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Sum-free_sequence">Sum-free sequence</a>
%e a(10) = 13. 3rd powers of 14, 15 and 16 can be written as sums of 3rd powers of a subset of the terms {a(1)..a(10)}:
%e 14^3 = 2^3 + 3^3 + 8^3 + 13^3,
%e 15^3 = 4^3 + 5^3 + 7^3 + 8^3 + 10^3 + 11^3,
%e 16^3 = 1^3 + 2^3 + 3^3 + 4^3 + 5^3 + 7^3 + 11^3 + 13^3,
%e 17^3 cannot be written in this way, so a(11) = 17 is the next term.
%o (Python)
%o def findSum(nopt, tgt, a, smax, pwr):
%o ....if nopt==0:
%o ........return [] if tgt==0 else None
%o ....if tgt<0 or tgt>smax[nopt-1]:
%o ........return None
%o ....rv=findSum(nopt-1, tgt - a[nopt-1]**pwr, a, smax, pwr)
%o ....if rv!=None:
%o ........rv.append(a[nopt-1])
%o ....else:
%o ........rv=findSum(nopt-1,tgt, a, smax, pwr)
%o ....return rv
%o def A321290(n):
%o ....POWER=3 ; x=0 ; a=[] ; smax=[] ; sumpwr=0
%o ....while len(a)<n:
%o ........while True:
%o ............x+=1
%o ............lst=findSum(len(a), x**POWER, a, smax, POWER)
%o ............if lst==None:
%o ................break
%o ............rhs = " + ".join(["%d^%d"%(i,POWER) for i in lst])
%o ............print(" %d^%d = %s"%(x,POWER,rhs))
%o ........a.append(x) ; sumpwr+=x**POWER
%o ........print("a(%d) = %d"%(len(a),x))
%o ........smax.append(sumpwr)
%o ....return a[-1]
%Y Other powers: A321266 (2), A321291 (4), A321292 (5), A321293 (6)
%K nonn
%O 1,2
%A _Bert Dobbelaere_, Nov 02 2018
|