Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Tau-function/AWK/tau-function.awk
Normal file
19
Task/Tau-function/AWK/tau-function.awk
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# syntax: GAWK -f TAU_FUNCTION.AWK
|
||||
BEGIN {
|
||||
print("The tau functions for the first 100 positive integers:")
|
||||
for (i=1; i<=100; i++) {
|
||||
printf("%2d ",count_divisors(i))
|
||||
if (i % 10 == 0) {
|
||||
printf("\n")
|
||||
}
|
||||
}
|
||||
exit(0)
|
||||
}
|
||||
function count_divisors(n, count,i) {
|
||||
for (i=1; i*i<=n; i++) {
|
||||
if (n % i == 0) {
|
||||
count += (i == n / i) ? 1 : 2
|
||||
}
|
||||
}
|
||||
return(count)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue