RosettaCodeData/Task/Totient-function/Sidef/totient-function-3.sidef

5 lines
152 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
[100, 1_000, 10_000, 100_000].each {|limit|
var pi = (1..limit -> count_by {|n| 𝜑(n) == (n-1) })
say "Number of primes <= #{limit}: #{pi}"
}