Data update

This commit is contained in:
Ingy döt Net 2024-03-06 22:25:12 -08:00
parent ed705008a8
commit 0df55f9f24
2196 changed files with 32999 additions and 3075 deletions

View file

@ -0,0 +1,29 @@
proc propdivs n . divs[] .
divs[] = [ ]
if n < 2
return
.
divs[] &= 1
sqr = sqrt n
for d = 2 to sqr
if n mod d = 0
divs[] &= d
if d <> sqr
divs[] &= n / d
.
.
.
.
for i to 10
propdivs i d[]
write i & ":"
print d[]
.
for i to 20000
propdivs i d[]
if len d[] > max
max = len d[]
maxi = i
.
.
print maxi & " has " & max & " proper divisors."

View file

@ -3,14 +3,13 @@ val .cntproper = f(.x) for[=0] .i of .x \ 2 { if .x div .i: _for += 1 }
val .listproper = f(.x) {
if .x < 1: return null
for .i of .x {
writeln $"\.i:2; -> ", .getproper(.i)
for[=""] .i of .x {
_for ~= $"\.i:2; -> \.getproper(.i);\n"
}
writeln()
}
writeln "The proper divisors of the following numbers are :"
.listproper(10)
writeln .listproper(10)
var .max = 0
var .most = []

View file

@ -1,5 +1,5 @@
import "/fmt" for Fmt
import "/math" for Int
import "./fmt" for Fmt
import "./math" for Int
for (i in 1..10) System.print("%(Fmt.d(2, i)) -> %(Int.properDivisors(i))")