Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,66 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
procedure Show_Humble is
|
||||
|
||||
type Positive is range 1 .. 2**63 - 1;
|
||||
First : constant Positive := Positive'First;
|
||||
Last : constant Positive := 999_999_999;
|
||||
|
||||
function Is_Humble (I : in Positive) return Boolean is
|
||||
begin
|
||||
if I <= 1 then return True;
|
||||
elsif I mod 2 = 0 then return Is_Humble (I / 2);
|
||||
elsif I mod 3 = 0 then return Is_Humble (I / 3);
|
||||
elsif I mod 5 = 0 then return Is_Humble (I / 5);
|
||||
elsif I mod 7 = 0 then return Is_Humble (I / 7);
|
||||
else return False;
|
||||
end if;
|
||||
end Is_Humble;
|
||||
|
||||
subtype Digit_Range is Natural range First'Image'Length - 1 .. Last'Image'Length - 1;
|
||||
Digit_Count : array (Digit_Range) of Natural := (others => 0);
|
||||
|
||||
procedure Count_Humble_Digits is
|
||||
use Ada.Text_IO;
|
||||
Humble_Count : Natural := 0;
|
||||
Len : Natural;
|
||||
begin
|
||||
Put_Line ("The first 50 humble numbers:");
|
||||
for N in First .. Last loop
|
||||
if Is_Humble (N) then
|
||||
Len := N'Image'Length - 1;
|
||||
Digit_Count (Len) := Digit_Count (Len) + 1;
|
||||
|
||||
if Humble_Count < 50 then
|
||||
Put (N'Image);
|
||||
Put (" ");
|
||||
end if;
|
||||
Humble_Count := Humble_Count + 1;
|
||||
end if;
|
||||
end loop;
|
||||
New_Line (2);
|
||||
end Count_Humble_Digits;
|
||||
|
||||
procedure Show_Digit_Counts is
|
||||
package Natural_IO is
|
||||
new Ada.Text_IO.Integer_IO (Natural);
|
||||
use Ada.Text_IO;
|
||||
use Natural_IO;
|
||||
|
||||
Placeholder : String := "Digits Count";
|
||||
Image_Digit : String renames Placeholder (1 .. 6);
|
||||
Image_Count : String renames Placeholder (8 .. Placeholder'Last);
|
||||
begin
|
||||
Put_Line ("The digit counts of humble numbers:");
|
||||
Put_Line (Placeholder);
|
||||
for Digit in Digit_Count'Range loop
|
||||
Put (Image_Digit, Digit);
|
||||
Put (Image_Count, Digit_Count (Digit));
|
||||
Put_Line (Placeholder);
|
||||
end loop;
|
||||
end Show_Digit_Counts;
|
||||
|
||||
begin
|
||||
Count_Humble_Digits;
|
||||
Show_Digit_Counts;
|
||||
end Show_Humble;
|
||||
|
|
@ -16,7 +16,8 @@ fastfunc next_humble n .
|
|||
len arr[] 9
|
||||
while cnt < 5193
|
||||
n = next_humble n
|
||||
arr[log10 n + 1] += 1
|
||||
idx = floor (log n 10 + 1)
|
||||
arr[idx] += 1
|
||||
cnt += 1
|
||||
if cnt <= 50 : write n & " "
|
||||
.
|
||||
|
|
|
|||
|
|
@ -11,18 +11,18 @@ do -- find some Humble numbers - numbers with no prime factors above 7
|
|||
local m = math.min( p2, p3, p5, p7 )
|
||||
h[ n ] = m
|
||||
if n <= maxShownHumble then io.write( " ", m ) end
|
||||
if m == p2 then ++ last2 p2 = 2 * h[ last2 ] end
|
||||
if m == p3 then ++ last3 p3 = 3 * h[ last3 ] end
|
||||
if m == p5 then ++ last5 p5 = 5 * h[ last5 ] end
|
||||
if m == p7 then ++ last7 p7 = 7 * h[ last7 ] end
|
||||
++ hCount[ ( m < 10 ) ? 1
|
||||
: ( m < 100 ) ? 2
|
||||
: ( m < 1_000 ) ? 3
|
||||
: ( m < 10_000 ) ? 4
|
||||
: ( m < 100_000 ) ? 5
|
||||
: ( m < 1_000_000 ) ? 6
|
||||
: 0
|
||||
]
|
||||
if m == p2 then last2 += 1 p2 = 2 * h[ last2 ] end
|
||||
if m == p3 then last3 += 1 p3 = 3 * h[ last3 ] end
|
||||
if m == p5 then last5 += 1 p5 = 5 * h[ last5 ] end
|
||||
if m == p7 then last7 += 1 p7 = 7 * h[ last7 ] end
|
||||
hCount[ ( m < 10 ) ? 1
|
||||
: ( m < 100 ) ? 2
|
||||
: ( m < 1_000 ) ? 3
|
||||
: ( m < 10_000 ) ? 4
|
||||
: ( m < 100_000 ) ? 5
|
||||
: ( m < 1_000_000 ) ? 6
|
||||
: 0
|
||||
] += 1
|
||||
end
|
||||
io.write( "\n" )
|
||||
for i = 1, 6 do
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-- 22 Mar 2025
|
||||
include Settings
|
||||
-- 23 Aug 2025
|
||||
include Setting
|
||||
|
||||
say 'HUMBLE NUMBERS'
|
||||
say version
|
||||
|
|
@ -43,6 +43,4 @@ end
|
|||
say l
|
||||
return
|
||||
|
||||
include Abend
|
||||
include Functions
|
||||
include Sequences
|
||||
include Math
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue