with javascript_semantics function mnmnn(sequence counts, integer limit=2000) if gcd(counts)>1 then return "No maximum" end if sequence nuggets = repeat(false,limit+1) integer {i,j,k} = counts for a=0 to limit by i do for b=a to limit by j do for c=b to limit by k do nuggets[c+1] = true end for end for end for return sprintf("%d",rfind(false,nuggets)-1) end function printf(1,"Maximum non-McNuggets number is %s\n", mnmnn({6,9,20},100))