Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,53 @@
|
|||
on aliquotSum(n)
|
||||
if (n < 2) then return 0
|
||||
set sum to 1
|
||||
set sqrt to n ^ 0.5
|
||||
set limit to sqrt div 1
|
||||
if (limit = sqrt) then
|
||||
set sum to sum + limit
|
||||
set limit to limit - 1
|
||||
end if
|
||||
repeat with i from 2 to limit
|
||||
if (n mod i is 0) then set sum to sum + i + n div i
|
||||
end repeat
|
||||
|
||||
return sum
|
||||
end aliquotSum
|
||||
|
||||
-- Task code:
|
||||
local output, counter, n, sum, astid
|
||||
set output to {"The first 25 abundant odd numbers:"}
|
||||
set counter to 0
|
||||
set n to 1
|
||||
repeat until (counter = 25)
|
||||
set sum to aliquotSum(n)
|
||||
if (sum > n) then
|
||||
set end of output to " " & n & " (proper divisor sum: " & sum & ")"
|
||||
set counter to counter + 1
|
||||
end if
|
||||
set n to n + 2
|
||||
end repeat
|
||||
|
||||
set end of output to "The one thousandth:"
|
||||
repeat until (counter = 1000)
|
||||
set sum to aliquotSum(n)
|
||||
if (sum > n) then set counter to counter + 1
|
||||
set n to n + 2
|
||||
end repeat
|
||||
set end of output to " " & (n - 2) & " (proper divisor sum: " & sum & ")"
|
||||
|
||||
set end of output to "The first > 1,000,000,000:"
|
||||
set n to 1.000000001E+9
|
||||
set sum to aliquotSum(n)
|
||||
repeat until (sum > n)
|
||||
set n to n + 2
|
||||
set sum to aliquotSum(n)
|
||||
end repeat
|
||||
set end of output to " " & (n div 1000000) & text 2 thru -1 of ((1000000 + ((n mod 1000000) as integer)) as text) & ¬
|
||||
" (proper divisor sum: " & (sum div 1000000) & text 2 thru -1 of ((1000000 + ((sum mod 1000000) as integer)) as text) & ")"
|
||||
|
||||
set astid to AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to linefeed
|
||||
set output to output as text
|
||||
set AppleScript's text item delimiters to astid
|
||||
return output
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
"The first 25 abundant odd numbers:
|
||||
945 (proper divisor sum: 975)
|
||||
1575 (proper divisor sum: 1649)
|
||||
2205 (proper divisor sum: 2241)
|
||||
2835 (proper divisor sum: 2973)
|
||||
3465 (proper divisor sum: 4023)
|
||||
4095 (proper divisor sum: 4641)
|
||||
4725 (proper divisor sum: 5195)
|
||||
5355 (proper divisor sum: 5877)
|
||||
5775 (proper divisor sum: 6129)
|
||||
5985 (proper divisor sum: 6495)
|
||||
6435 (proper divisor sum: 6669)
|
||||
6615 (proper divisor sum: 7065)
|
||||
6825 (proper divisor sum: 7063)
|
||||
7245 (proper divisor sum: 7731)
|
||||
7425 (proper divisor sum: 7455)
|
||||
7875 (proper divisor sum: 8349)
|
||||
8085 (proper divisor sum: 8331)
|
||||
8415 (proper divisor sum: 8433)
|
||||
8505 (proper divisor sum: 8967)
|
||||
8925 (proper divisor sum: 8931)
|
||||
9135 (proper divisor sum: 9585)
|
||||
9555 (proper divisor sum: 9597)
|
||||
9765 (proper divisor sum: 10203)
|
||||
10395 (proper divisor sum: 12645)
|
||||
11025 (proper divisor sum: 11946)
|
||||
The one thousandth:
|
||||
492975 (proper divisor sum: 519361)
|
||||
The first > 1,000,000,000:
|
||||
1000000575 (proper divisor sum: 1083561009)"
|
||||
Loading…
Add table
Add a link
Reference in a new issue