cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A321266 #15 May 22 2025 10:21:48
%S A321266 1,2,3,4,6,8,12,16,17,24,32,34,48,64,68,96,128,136,192,256,272,384,
%T A321266 512,544,768,1024,1088,1536,2048,2176,3072,4096,4352,6144,8192,8704,
%U A321266 12288,16384,17408,24576,32768,34816,49152,65536,69632,98304,131072,139264
%N A321266 Smallest positive number for which the square cannot be written as sum of distinct squares of any subset of previous terms.
%C A321266 a(n)^2 = A226076(n) forms a sum-free sequence.
%H A321266 Bert Dobbelaere, <a href="/A321266/b321266.txt">Table of n, a(n) for n = 1..89</a>
%H A321266 Wikipedia, <a href="https://en.wikipedia.org/wiki/Sum-free_sequence">Sum-free sequence</a>
%F A321266 a(n) = 2 * a(n-3) for n > 9 (conjectured).
%e A321266 0^2 = 0 (sum of squares of the empty set).
%e A321266 1^2 cannot be written as sum of squares of the empty set, so a(1)=1.
%e A321266 Suppose we determined all terms up to a(7)=12:
%e A321266 13^2 = 12^2 + 4^2 + 3^2,
%e A321266 14^2 = 12^2 + 6^2 + 4^2,
%e A321266 15^2 = 12^2 + 8^2 + 4^2 + 1^2.
%e A321266 16^2 cannot be written as sum of squares of distinct smaller terms, hence a(8)=16.
%o A321266 (Python)
%o A321266 def findSum(nopt, tgt, a, smax, pwr):
%o A321266     if nopt==0:
%o A321266         return [] if tgt==0 else None
%o A321266     if tgt<0 or tgt>smax[nopt-1]:
%o A321266         return None
%o A321266     rv=findSum(nopt-1, tgt - a[nopt-1]**pwr, a, smax, pwr)
%o A321266     if rv!=None:
%o A321266         rv.append(a[nopt-1])
%o A321266     else:
%o A321266         rv=findSum(nopt-1,tgt, a, smax, pwr)
%o A321266     return rv
%o A321266 def A321266(n):
%o A321266     POWER=2 ; x=0 ; a=[] ; smax=[] ; sumpwr=0
%o A321266     while len(a)<n:
%o A321266         while True:
%o A321266             x+=1
%o A321266             lst=findSum(len(a), x**POWER, a, smax, POWER)
%o A321266             if lst==None:
%o A321266                 break
%o A321266             rhs = " + ".join(["%d^%d"%(i,POWER) for i in lst])
%o A321266             print("    %d^%d = %s"%(x,POWER,rhs))
%o A321266         a.append(x) ; sumpwr+=x**POWER
%o A321266         print("a(%d) = %d"%(len(a),x))
%o A321266         smax.append(sumpwr)
%o A321266     return a[-1]
%Y A321266 Square root of A226076.
%Y A321266 Other powers: A321290 (3), A321291 (4), A321292 (5), A321293 (6).
%K A321266 nonn
%O A321266 1,2
%A A321266 _Bert Dobbelaere_, Nov 01 2018