Primes whose sum of digits is 25
Appearance
Primes whose sum of digits is 25 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
Show primes which sum of digits is 25
Let 0 < n < 5000
Ring
<lang ring> load "stdlib.ring"
row = 0 limit1 = 25 limit2 = 5000
for n = 1 to limit2
if isprime(n) bool = sum25(n) if bool = 1 row = row + 1 see "" + n + " " if (row%5) = 0 see nl ok ok ok
next
func sum25(n)
sum = 0 str = string(n) for n = 1 to len(str) sum = sum + number(str[n]) next if sum = limit1 return 1 ok
</lang>
- Output:
997 1699 1789 1879 1987 2689 2797 2887 3499 3697 3769 3877 3967 4597 4759 4957 4993