maxNumber = 324
len isSum[] maxNumber
maxSquare = floor sqrt maxNumber
# 
proc flagSum currSum sqPos . .
   nextSum = currSum + sqPos * sqPos
   if nextSum <= maxNumber
      isSum[nextSum] = 1
      for i = sqPos + 1 to maxSquare
         flagSum nextSum i
      .
   .
.
for i = 1 to maxSquare
   flagSum 0 i
.
for i = 1 to maxNumber
   if isSum[i] = 0
      write i & " "
   .
.
