Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
commit 74c69a0df6
2427 changed files with 31832 additions and 3474 deletions

View file

@ -0,0 +1,44 @@
divisorSum = function(n)
ans = 0
i = 1
while i * i <= n
if n % i == 0 then
ans += i
j = floor(n / i)
if j != i then ans += j
end if
i += 1
end while
return ans
end function
cnt = 0
n = 1
while cnt < 25
sum = divisorSum(n) - n
if sum > n then
print n + ": " + sum
cnt += 1
end if
n += 2
end while
while true
sum = divisorSum(n) - n
if sum > n then
cnt += 1
if cnt == 1000 then break
end if
n += 2
end while
print "The 1000th abundant number is " + n + " with a proper divisor sum of " + sum
n = 1000000001
while true
sum = divisorSum(n) - n
if sum > n and n > 1000000000 then break
n += 2
end while
print "The first abundant number > 1b is " + n + " with a proper divisor sum of " + sum

View file

@ -1,5 +1,5 @@
import "/fmt" for Fmt
import "/math" for Int, Nums
import "./fmt" for Fmt
import "./math" for Int, Nums
var sumStr = Fn.new { |divs| divs.reduce("") { |acc, div| acc + "%(div) + " }[0...-3] }
@ -14,9 +14,9 @@ var abundantOdd = Fn.new { |searchFrom, countFrom, countTo, printOne|
if (!printOne || count >= countTo) {
var s = sumStr.call(divs)
if (!printOne) {
System.print("%(Fmt.d(2, count)). %(Fmt.d(5, n)) < %(s) = %(tot)")
Fmt.print("$2d. $5d < $s = $d", count, n, s, tot)
} else {
System.print("%(n) < %(s) = %(tot)")
Fmt.print("$d < $s = $d", n, s, tot)
}
}
}