DescendingPrimes: Difference between revisions
Content added Content deleted
(Created page with "=={{header|Ring}}== <lang ring> load "stdlibcore.ring" limit = 1000 row = 0 for n = 1 to limit flag = 0 strn = string(n) if isprime(n) = 1 for m = 1 to...") |
m (since this was a duplicate page title, its page should be a redirect.) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
#REDIRECT [[Descending primes]] |
|||
=={{header|Ring}}== |
|||
<lang ring> |
|||
load "stdlibcore.ring" |
|||
limit = 1000 |
|||
row = 0 |
|||
for n = 1 to limit |
|||
flag = 0 |
|||
strn = string(n) |
|||
if isprime(n) = 1 |
|||
for m = 1 to len(strn)-1 |
|||
if number(substr(strn,m)) > number(substr(strn,m+1)) |
|||
flag = 1 |
|||
ok |
|||
next |
|||
if flag = 1 |
|||
row++ |
|||
see "" + n + " " |
|||
ok |
|||
if row % 10 = 0 |
|||
see nl |
|||
ok |
|||
ok |
|||
next |
|||
</lang> |
|||
Output: |
Latest revision as of 14:16, 29 March 2022
Redirect to: