Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,19 +1,19 @@
fun countDivisors = int by int n
fun countDivisors int by int n
if n < 2 do return 1 end
int count = 2
for int i = 2; i <= n / 2; ++i
if n % i == 0 do ++count end
int count 2
for int i ← 2; i ≤ n / 2; ++i
if n % i æ 0 do ++count end
end
return count
end
int maxDiv = 0
int count = 0
int maxDiv 0
int count 0
writeLine("The first 20 anti-primes are:")
for int n = 1; count < 20; ++n
int d = countDivisors(n)
if d <= maxDiv do continue end # never nester version
for int n 1; count < 20; ++n
int d countDivisors(n)
if d ≤ maxDiv do continue end
write(n + " ")
maxDiv = d
maxDiv d
++count
end
writeLine()

View file

@ -0,0 +1,27 @@
function countdiv(n: integer): integer;
begin
result := Range(1, n.Sqrt.Trunc).Count(x -> n mod x = 0) * 2;
if n.Sqrt.Round.sqr = n then result -= 1;
end;
function AntiPrimes(): sequence of integer;
begin
var maxDiv := 0;
var i := 1;
while True do
begin
var d := countdiv(i);
if d > maxDiv then
begin
yield i;
maxDiv := d;
end;
i += 1;
end;
end;
begin
AntiPrimes.Take(20).Println;
println;
AntiPrimes.Take(40).Println;
end.

View file

@ -0,0 +1,43 @@
include Settings
say version; say 'Anti-prims'; say
arg n
numeric digits 16
if n = '' then
n = 10000
show = (n > 0); n = Abs(n)
h = Highcomposites(n)
say h 'anti-primes found below' n
if show then do
do i = 1 to high.0
say i high.highcomposite.i
end
end
say time('e') 'seconds'
exit
Highcomposites:
/* Highly composite sequence */
procedure expose high.
arg x
/* Thresholds and increments */
a = '1 2 6 60 840 55440 720720 61261200 2327925600 321253732800 9999999999999'
b = '1 2 6 60 420 27720 360360 12252240 232792560 80313433200 9999999999999'
c = Words(a)-1; m = 0; n = 0
/* Colllect cf definition */
do i = 1 to c
do j = Word(a,i) by Word(b,i) to Min(x,Word(a,i+1)-1)
d = Divisors(j)
if d > m then do
n = n+1; high.highcomposite.n = j
m = d
end
end
end
high.0 = n
/* Return count */
return n
include Numbers
include Functions
include Abend