Smarandache prime-digital sequence: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{task|Calmo primes}} |
{{draft task|Calmo primes}} |
||
Prime p is Calmo prime if each its digit is also prime. |
Prime p is Calmo prime if each its digit is also prime. |
Revision as of 08:46, 31 May 2019
Smarandache prime-digital sequence 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.
Prime p is Calmo prime if each its digit is also prime.
- Task
Show first 25 Calmo primes.
Show hundrest Calmo prime.
Ring
<lang ring>
- Project: Calmo primes
load "stdlib.ring" limit = 25 max = 300000 num = 0 see "working..." + nl see "wait for done..." + nl see "First 25 Calmo primes are:" + nl for n = 1 to max
if isprime(n) res = calmo(n) if res = 1 num = num + 1 if num < limit + 1 see "" + num + ". " + n + nl ok if num = 100 see "The hundrest Calmo prime is:" + nl see "" + num + ". " + n + nl exit ok ok ok
next see "done..." + nl
func calmo(p)
sp = string(p) for n = 1 to len(sp) if not isprime(sp[n]) return 0 ok next return 1
</lang>
working... wait for done... First 25 Calmo primes are: 1. 2 2. 3 3. 5 4. 7 5. 23 6. 37 7. 53 8. 73 9. 223 10. 227 11. 233 12. 257 13. 277 14. 337 15. 353 16. 373 17. 523 18. 557 19. 577 20. 727 21. 733 22. 757 23. 773 24. 2237 25. 2273 The hundrest Calmo prime is: 100. 33223 done...