Concatenate two primes is also prime: Difference between revisions
Content added Content deleted
m (added a period to a sentence in the task preamble.) |
m (→{{header|REXX}}: simplified a DO loop.) |
||
Line 175: | Line 175: | ||
a.= 0 /*array of "2cat" primes */ |
a.= 0 /*array of "2cat" primes */ |
||
do j=1 for ## /*search through specified primes. */ |
do j=1 for ## /*search through specified primes. */ |
||
do k=1 for ## |
do k=1 for ##; cat2= @.j || @.k /*create a concatenated prime (base 10)*/ |
||
if !.cat2 then a.cat2= 1 /*flag it as being a "2cat" prime. */ |
|||
end /*k*/ /* [↑] forgoes the need for sorting. */ |
|||
end /*k*/ /* [↑] forgoes the need for sorting. */ |
|||
end /*j*/ |
end /*j*/ |
||
found= 0; idx= 1 /*initialize # of primes found; IDX. */ |
found= 0; idx= 1 /*initialize # of primes found; IDX. */ |