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.

A138554 Minimal value of sum k_i when sum (k_i)^2 = n.

This page as a plain text file.
%I A138554 #20 Nov 05 2020 06:40:50
%S A138554 0,1,2,3,2,3,4,5,4,3,4,5,6,5,6,7,4,5,6,7,6,7,8,9,8,5,6,7,8,7,8,9,8,9,
%T A138554 8,9,6,7,8,9,8,9,10,11,10,9,10,11,12,7,8,9,10,9,10,11,12,11,10,11,12,
%U A138554 11,12,13,8,9,10,11,10,11,12,13,12,11,12,13,14,13,14,15,12,9,10,11,12,11
%N A138554 Minimal value of sum k_i when sum (k_i)^2 = n.
%H A138554 Alois P. Heinz, <a href="/A138554/b138554.txt">Table of n, a(n) for n = 0..20163</a>
%H A138554 Phillip Tomas Heikoop, <a href="https://digitalcommons.wpi.edu/mqp-all/6822">Dimensions of Matrix Subalgebras</a>, Bachelor's Thesis, Worcester Polytechnic Institute (Massachusetts, 2019).
%e A138554 32 = 4^2 + 4^2 and 4+4 = 8. Using 5, the best we can do is 32 = 5^2 + 2^2 + 1^2 + 1^2 + 1^2 and 5+2+1+1+1 = 10, so a(32) = 8.
%p A138554 b:= proc(n, i) option remember; `if`(n=0 or i=1, n,
%p A138554        min(seq(b(n-j*i^2, i-1)+j*i, j=0..n/i^2)))
%p A138554     end:
%p A138554 a:= n-> b(n, isqrt(n)):
%p A138554 seq(a(n), n=0..100);  # _Alois P. Heinz_, Jun 30 2015
%t A138554 b[n_, i_] := b[n, i] = If[n == 0 || i == 1, n, Min[Table[b[n - j i^2, i - 1] + j i, {j, 0, n/i^2}]]];
%t A138554 a[n_] := b[n, Sqrt[n] // Floor];
%t A138554 a /@ Range[0, 100] (* _Jean-François Alcover_, Nov 05 2020, after _Alois P. Heinz_ *)
%o A138554 (PARI) sslist(n) = {local(r,i,v,t); r=vector(n+1,k,0); for(k=1,n,v=k;i=1;while(i^2<=k,t=r[k-i^2+1]+i;if(t<v,v=t);i++);r[k+1]=v); r}
%Y A138554 Cf A063772, A138555, A001156.
%K A138554 nonn,look
%O A138554 0,3
%A A138554 _Franklin T. Adams-Watters_, Mar 24 2008