Decompose integer into sum of squares by 51b

a[];f(n,y){y=a[n]/9,n&&f(n-y*y)+printf(" %d",y);}main(n,m,l,x,k){for(;n<301;printf("%d:",n),f(n++),puts(""))for(m=9,x=0;k=a[l=n-++x*x]%9,l>=0;)m>k?m=k,a[n]=9*x+m+1:0;}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page