Palindromic primes: Difference between revisions
Content added Content deleted
(Created page with "{{Draft task}} Category:Prime Numbers ;Task: Find palindromic primes, where '''n < 1000''' <br><br> =={{header|Ring}}== <lang ring> load "stdlib.ring" decimals(0) see "w...") |
m (added whitespace.) |
||
Line 3: | Line 3: | ||
;Task: |
;Task: |
||
Find palindromic primes, where '''n |
Find and show all palindromic primes <big>'''n'''</big>, where <big> '''n < 1000''' </big> |
||
<br><br> |
<br><br> |
||
=={{header|Ring}}== |
=={{header|Ring}}== |
||
<lang ring> |
<lang ring> |
Revision as of 11:05, 7 April 2021
Palindromic primes is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
Find and show all palindromic primes n, where n < 1000
Ring
<lang ring> load "stdlib.ring"
decimals(0) see "working..." + nl see "Palindromic primes are:" + nl
row = 0 limit = 1000
for n = 1 to limit
strn = string(n) if ispalindrome(strn) and isprime(n) row = row + 1 see "" + n + " " if row%5 = 0 see nl ok ok
next
see "Found " + row + " palindromic primes" + nl see "done..." + nl </lang>
- Output:
working... Palindromic primes are: 2 3 5 7 11 101 131 151 181 191 313 353 373 383 727 757 787 797 919 929 Found 20 palindromic primes done...