login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A321266 Smallest positive number for which the square cannot be written as sum of distinct squares of any subset of previous terms. 5

%I #13 Dec 08 2018 17:25:25

%S 1,2,3,4,6,8,12,16,17,24,32,34,48,64,68,96,128,136,192,256,272,384,

%T 512,544,768,1024,1088,1536,2048,2176,3072,4096,4352,6144,8192,8704,

%U 12288,16384,17408,24576,32768,34816,49152,65536,69632,98304,131072,139264

%N Smallest positive number for which the square cannot be written as sum of distinct squares of any subset of previous terms.

%C a(n)^2 = A226076(n) forms a sum-free sequence.

%H Bert Dobbelaere, <a href="/A321266/b321266.txt">Table of n, a(n) for n = 1..89</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Sum-free_sequence">Sum-free sequence</a>

%F a(n) = 2 * a(n-3) for n > 9 (conjectured).

%e 0^2 = 0 (sum of squares of the empty set).

%e 1^2 cannot be written as sum of squares of the empty set, so a(1)=1.

%e Suppose we determined all terms up to a(7)=12:

%e 13^2 = 12^2 + 4^2 + 3^2,

%e 14^2 = 12^2 + 6^2 + 4^2,

%e 15^2 = 12^2 + 8^2 + 4^2 + 1^2.

%e 16^2 cannot be written as sum of squares of distinct smaller terms, hence a(8)=16.

%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 A321266(n):

%o ....POWER=2 ; 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 Square root of A226076.

%Y Other powers: A321290 (3), A321291 (4), A321292 (5), A321293 (6).

%K nonn

%O 1,2

%A _Bert Dobbelaere_, Nov 01 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 09:04 EDT 2024. Contains 371799 sequences. (Running on oeis4.)