use ntheory ":all"; use feature "say"; say scalar(grep { gcd($_,13*17*19)==1 } 1..2310);
Seems much easier than all the looping or recursion. The gcd will return 1 if the two inputs have no common factors -- if it isn't divisible by 13, 17, or 19 in this example.
In reply to Re: Nested loops
by danaj
in thread Nested loops
by robert44444uk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |