Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Tau-function/AppleScript/tau-function-1.applescript
Normal file
24
Task/Tau-function/AppleScript/tau-function-1.applescript
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
on factorCount(n)
|
||||
if (n < 1) then return 0
|
||||
set counter to 2
|
||||
set sqrt to n ^ 0.5
|
||||
if (sqrt mod 1 = 0) then set counter to 1
|
||||
repeat with i from (sqrt div 1) to 2 by -1
|
||||
if (n mod i = 0) then set counter to counter + 2
|
||||
end repeat
|
||||
|
||||
return counter
|
||||
end factorCount
|
||||
|
||||
-- Task code:
|
||||
local output, n, astid
|
||||
set output to {"Positive divisor counts for integers 1 to 100:"}
|
||||
repeat with n from 1 to 100
|
||||
if (n mod 20 = 1) then set end of output to linefeed
|
||||
set end of output to text -3 thru -1 of (" " & factorCount(n))
|
||||
end repeat
|
||||
set astid to AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to ""
|
||||
set output to output as text
|
||||
set AppleScript's text item delimiters to astid
|
||||
return output
|
||||
Loading…
Add table
Add a link
Reference in a new issue