Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
say factor(536870911) #=> [233, 1103, 2089]
|
||||
say factor_exp(536870911) #=> [[233, 1], [1103, 1], [2089, 1]]
|
||||
18
Task/Prime-decomposition/Sidef/prime-decomposition-2.sidef
Normal file
18
Task/Prime-decomposition/Sidef/prime-decomposition-2.sidef
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
func prime_factors(n) {
|
||||
return [] if (n < 1)
|
||||
gather {
|
||||
while (!(n & 1)) {
|
||||
n >>= 1
|
||||
take(2)
|
||||
}
|
||||
var p = 3
|
||||
while ((n > 1) && (p*p <= n)) {
|
||||
while (n %% p) {
|
||||
n //= p
|
||||
take(p)
|
||||
}
|
||||
p += 2
|
||||
}
|
||||
take(n) if (n > 1)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
say prime_factors(536870911) #=> [233, 1103, 2089]
|
||||
Loading…
Add table
Add a link
Reference in a new issue