Find squares n where n+1 is prime: Difference between revisions

Content added Content deleted
(Created Nim solution.)
(add RPL)
Line 914: Line 914:
Found 10 numbers
Found 10 numbers
done...
done...
</pre>

=={{header|RPL}}==
≪ { }
1 1000 √ '''FOR''' j
'''IF''' j SQ 1 + ISPRIME? '''THEN''' j SQ + '''END'''
'''NEXT'''
≫ '<span style="color:blue>TASK</span>' STO
{{out}}
<pre>
1: { 1 4 16 36 100 196 256 400 576 676 }
</pre>
</pre>


Line 924: Line 935:
[1, 4, 16, 36, 100, 196, 256, 400, 576, 676]
[1, 4, 16, 36, 100, 196, 256, 400, 576, 676]
</pre>
</pre>

=={{header|Sidef}}==
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">1..1000.isqrt -> map { _**2 }.grep { is_prime(_+1) }.say</syntaxhighlight>
<syntaxhighlight lang="ruby">1..1000.isqrt -> map { _**2 }.grep { is_prime(_+1) }.say</syntaxhighlight>