Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,6 +1,6 @@
scope # Goldbach's comet, translation of Pluto
local procedure goldbach( n :: number ) :: number
local proc goldbach( n :: number ) :: number
local count := 0;
for i to n \ 2 do
if numtheory.isprime( i ) and numtheory.isprime( n - i ) then

View file

@ -13,6 +13,4 @@ print ["\nG(1000000) =" G 1000000]
csv: join.with:",\n" map select 4..2000 => even? 'x ->
~"|x|, |G x|"
; write the CSV data to a file which we can then visualize
; via our preferred spreadsheet app
write "comet.csv" csv
csv >> "comet.csv"

View file

@ -19,10 +19,10 @@ FOR I = 1 TO MAX_G G[I] = 0: NEXT
G[4] = 1 ' 4 is the only sum of 2 even primes
FOR I = 3 TO HALF_MAX_G STEP 2
IF P[I] THEN
INC G[I + 1]
FOR J = I + 2 TO MAX_G - 1
INC G[I + I]
FOR J = I + 2 TO MAX_G - I
IF P[J] THEN
INC G[I + 1]
INC G[I + J]
ENDIF
NEXT
ENDIF
@ -41,7 +41,7 @@ FOR I = 3 TO MAX_P DIV 2 STEP 2
NEXT
PRINT FORMAT$("G(%D): ", MAX_P); GM
FOR I = 2 TO MAX_G - 10 STEP 10
FOR J = 1 TO I + 8 STEP 2
FOR J = I TO I + 8 STEP 2
GPSET I DIV 10, 240-G[J],RGB(255,255,255)
NEXT
NEXT

View file

@ -1,23 +0,0 @@
do -- Goldbach's comet, translation of Lua
local int = require( "int" ) -- RC Pluto integer library, inc. prime utilities
local function goldbach( n : number ) : number
local count = 0
for i = 1, n // 2 do
if int.isprime( i ) and int.isprime( n - i ) then
++ count
end
end
return count
end
print( "The first 100 G numbers:" )
print( range( 100 ):map( | n | -> string.format( "%2d"..if n % 10 == 0 then "\n" else " " end
, goldbach( 2 + n * 2 )
)
)
:concat( "" )
)
print( $"G(1000000) = { goldbach( 1_000_000 ) }" )
end

View file

@ -1,5 +1,5 @@
-- 22 Mar 2025
include Settings
-- 23 Aug 2025
include Setting
say 'GOLDBACH''S COMET'
say version
@ -55,6 +55,4 @@ do i = 2 to x%2
end
return y/1
include Abend
include Functions
include Sequences
include Math