Prime numbers which contain 123: Difference between revisions
Content added Content deleted
(Prime numbers which contain 123 in PureBasic) |
Drkameleon (talk | contribs) (added Arturo implementation) |
||
Line 94: | Line 94: | ||
Found 451 "123" primes below 1000000 |
Found 451 "123" primes below 1000000 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol>upTo100K: select select 2..99999 => odd? => prime? |
|||
upTo1M: upTo100K ++ select select 100001..999999 => odd? => prime? |
|||
contains123?: function [x] -> contains? to :string x "123" |
|||
loop split.every:10 select upTo100K => contains123? 'a -> |
|||
print map a => [pad to :string & 5] |
|||
print "" |
|||
print ["'123' Numbers < 1000000:" size select upTo1M => contains123?]</lang> |
|||
{{out}} |
|||
<pre> 1123 1231 1237 8123 11239 12301 12323 12329 12343 12347 |
|||
12373 12377 12379 12391 17123 20123 22123 28123 29123 31123 |
|||
31231 31237 34123 37123 40123 41231 41233 44123 47123 49123 |
|||
50123 51239 56123 59123 61231 64123 65123 70123 71233 71237 |
|||
76123 81233 81239 89123 91237 98123 |
|||
'123' Numbers < 1000000: 451</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |