Numbers which are not the sum of distinct squares: Difference between revisions

m
→‎{{header|Raku}}: more concise
m (more white space tweaks)
m (→‎{{header|Raku}}: more concise)
Line 35:
 
=={{header|Raku}}==
[https://tio.run/##jVA7TsMwGN5zik9qhpSHpS4MjVKxcgZEKwN/wJLjJH4gqih7uQSHYGXrUXqRYNfUZSSDpfh7uyMtb6ap2eLW9I5rMqiwPuw@wRreLXGx/yoxw52qhRKWYEgLz2lr/NKzrG41FowFzfUKuekxIH0zBJjeSG/x1DaPQnErWhUMuJTJJFCPHVwTCpy63K@93QP7IzT7b@ZJzCnRO2Km1bZMau1U/AmZ0WvITk0CyjpnXot8MwdXz1D0buGUJGMiSpIaUyaFqJFvUFURtFxIXGLh1yWrZSCMIGnIX0tubBCdvbA6TwlLyiPmBxZzjMeceHbO4kVTh8H7HXYfsfx4hcI/bEqPrf@Rko3T9AM Try it online!]
[https://tio.run/##jZA9TsQwEIX7nOIVKcKfpW0oNsqKeyB2ZWAWItmO47ElUJR@uQSHoKXbo@xFgo0hoWQ6z5v3vRlbcup6mvQrbrgP0hGjwfZ0eIfQ0q5xfvyoi2LfOayESO2rDUruMRSI9W0LOnl@7bfbKN@Jh07ft0b6tjN8/BRxSATT9oEEd87Xs9sFkx8pIrMyOlVShQ38XJW7M0jzCEMvHsEoYs4qKdJcz452j3KHpsmil63CBVYYFtQ6DYwgxfTTjstXf@jjDFOSfSIuQdgsd6Yzc3B22ODx5MhiiAGnw1u@ZrxEFX9uXicH/Yc8TtMX Try it online!]
 
'''Spoiler:''' ''(highlight to read)''<br>
Line 46:
for @sums {
@run.push($_) and next unless @run.elems;
if $_ == @run.tail + 1 { @run.push: $_ } else { last if @run.elems > @squares[$sq]; @run = () and next }
last if @run.elems > @squares[$sq];
}
put grep {$_ ∉ @sums}, (1..@run.tail) and last if @run.elems > @squares[$sq];
10,327

edits