Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Prime-decomposition/AWK/prime-decomposition.awk
Normal file
15
Task/Prime-decomposition/AWK/prime-decomposition.awk
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Usage: awk -f primefac.awk
|
||||
function pfac(n, r, f){
|
||||
r = ""; f = 2
|
||||
while (f <= n) {
|
||||
while(!(n % f)) {
|
||||
n = n / f
|
||||
r = r " " f
|
||||
}
|
||||
f = f + 2 - (f == 2)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
# For each line of input, print the prime factors.
|
||||
{ print pfac($1) }
|
||||
Loading…
Add table
Add a link
Reference in a new issue