Palindromic primes
Find palindromic primes, where n < 1000
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
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...