OFFSET
0,3
LINKS
H. L Montgomery and U. M. A. Vorhauer, Greedy sums of distinct squares, Math. Comp. 73 (2004) 493-513, Table 1. [MR2034134].
MAPLE
greeds := proc(n) local arem, a, j ; arem := n ; a := [] ; while arem > 0 do j := floor(sqrt(arem)) ; a := [op(a), j] ; arem := arem-j^2 ; od: a ; end: isGreedS := proc(n) option remember; local L; L := greeds(n) ; RETURN( nops(L) = nops( convert(L, set)) ) ; end: a := proc(n) local resul, i ; resul := 0 ; for i from 0 to n-1 do if isGreedS(i) then resul := resul+1 ; fi; od: resul ; end: seq(a(n), n=0..80) ;
MATHEMATICA
greeds[n_] := Module[{arem = n, a = {}, j}, While[arem > 0, j = Floor[Sqrt[arem]]; AppendTo[a, j]; arem = arem - j^2]; a];
isGreedS[n_] := isGreedS[n] = Module[{L = greeds[n]}, Length[L] == Length[Union[L]]];
a[n_] := Module[{resul = 0, i}, For[i = 0, i <= n-1, i++, If[isGreedS[i], resul++]]; resul];
Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Nov 29 2023, after R. J. Mathar *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
R. J. Mathar, Mar 01 2009
STATUS
approved