Sequence of non-squares: Difference between revisions
Add Miranda
m (→{{header|RPL}}) |
Not a robot (talk | contribs) (Add Miranda) |
||
Line 1,759:
Squares for n below one million:
</pre>
=={{header|Miranda}}==
<syntaxhighlight lang="miranda">main :: [sys_message]
main = [Stdout (lay [first22, hassquare])]
first22 :: [char]
first22 = show (take 22 nonsqrseq)
hassquare :: [char]
hassquare = "Square found", if or [issquare n | n<-take 1000000 nonsqrseq]
= "No square found", otherwise
issquare :: num->bool
issquare n = n == (entier (sqrt n))^2
nonsqrseq :: [num]
nonsqrseq = map nonsqr [1..]
nonsqr :: num->num
nonsqr n = n + entier (0.5 + sqrt n)</syntaxhighlight>
{{out}}
<pre>[2,3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,26,27]
No square found</pre>
=={{header|МК-61/52}}==
|