Rare numbers: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 3,896: | Line 3,896: | ||
It could look something like the following (ignoring whatever optimizations the other examples are using), if it was fast enough. I did not have the time/processor to test finding the first 5. The .israre() function appears to return the right answer, tested with individual numbers. |
It could look something like the following (ignoring whatever optimizations the other examples are using), if it was fast enough. I did not have the time/processor to test finding the first 5. The .israre() function appears to return the right answer, tested with individual numbers. |
||
<syntaxhighlight lang="langur">val .perfectsquare = fn(.n) (.n ^/ 2) div 1 |
<syntaxhighlight lang="langur">val .perfectsquare = fn(.n) { (.n ^/ 2) div 1 } |
||
val .israre = fn(.n) { |
val .israre = fn(.n) { |