Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Totient-function/Sidef/totient-function-1.sidef
Normal file
5
Task/Totient-function/Sidef/totient-function-1.sidef
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
func 𝜑(n) {
|
||||
n.factor_exp.prod {|p|
|
||||
(p[0]-1) * p[0]**(p[1]-1)
|
||||
}
|
||||
}
|
||||
4
Task/Totient-function/Sidef/totient-function-2.sidef
Normal file
4
Task/Totient-function/Sidef/totient-function-2.sidef
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for n in (1..25) {
|
||||
var totient = 𝜑(n)
|
||||
printf("𝜑(%2s) = %3s%s\n", n, totient, totient==(n-1) ? ' - prime' : '')
|
||||
}
|
||||
4
Task/Totient-function/Sidef/totient-function-3.sidef
Normal file
4
Task/Totient-function/Sidef/totient-function-3.sidef
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[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}"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue