Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
59
Task/Blum-integer/REXX/blum-integer-1.rexx
Normal file
59
Task/Blum-integer/REXX/blum-integer-1.rexx
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
include Setting
|
||||
|
||||
Say Time()
|
||||
Call Time 'R'
|
||||
blumCount = 0
|
||||
blums.=0
|
||||
lastDigitCounts.=0
|
||||
Do number=5 By 4 While blumCount < 400000
|
||||
Prime=leastPrimeFactor(number)
|
||||
If Prime // 4=3 Then Do
|
||||
quotient=number / Prime;
|
||||
If quotient <> Prime & isPrimeType3(quotient) Then Do
|
||||
blumCount+=1
|
||||
If blumCount<=50 Then Do
|
||||
blums.blumCount=number
|
||||
End
|
||||
lastdigit=Right(number,1)
|
||||
lastDigitCounts.lastdigit+=1
|
||||
If blumCount=50 Then Do
|
||||
Say "The first 50 Blum integers:"
|
||||
Do i=1 To 50
|
||||
If Right(i,1)=1 Then
|
||||
l=Format(blums.i,3)
|
||||
Else
|
||||
l=l Format(blums.i,3)
|
||||
If i//10=0 Then
|
||||
Say l
|
||||
End
|
||||
Say ''
|
||||
End
|
||||
Else Do
|
||||
If blumCount=26828 | blumCount // 100000 = 0 Then Do
|
||||
Say "The " Format(blumCount,7)"th Blum Integer is:" Format(number,7) Time()
|
||||
If blumCount=400000 Then Do
|
||||
Say ''
|
||||
Say "Percent distribution of the first 400000 Blum integers:"
|
||||
Do i=0 To 9
|
||||
If lastDigitCounts.i>0 Then
|
||||
Say Format(lastDigitCounts.i/4000,6,3)'% end in' i
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
End
|
||||
Say Time()
|
||||
say Time('E') 'seconds'
|
||||
Exit
|
||||
|
||||
isPrimeType3: Procedure expose Memo.
|
||||
Parse Arg number
|
||||
Return Prime(number) & (number//4=3)
|
||||
|
||||
leastPrimeFactor: Procedure expose Memo.
|
||||
Parse Arg number
|
||||
Return FFactor(number)
|
||||
|
||||
include Math
|
||||
89
Task/Blum-integer/REXX/blum-integer-2.rexx
Normal file
89
Task/Blum-integer/REXX/blum-integer-2.rexx
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
-- 28 Aug 2025
|
||||
include Setting
|
||||
arg count
|
||||
if count = '' then
|
||||
count = 400000
|
||||
threshold=25*count
|
||||
|
||||
say 'BLUM INTEGER'
|
||||
say version
|
||||
say
|
||||
say 'Parameters...'
|
||||
say 'Threshold' threshold 'Count' count
|
||||
say
|
||||
say 'Collect primes...'
|
||||
say Primes(threshold) 'found'; say
|
||||
say 'Filter primes 3 modulo 4...'
|
||||
say Filter3Mod4() 'found'; say
|
||||
say 'Generate Blum integers...'
|
||||
say GenerateBlum(threshold) 'found'; say
|
||||
say 'Blum integers...'; say
|
||||
call Results threshold,count
|
||||
call Timer
|
||||
exit
|
||||
|
||||
Filter3Mod4:
|
||||
procedure expose Prim.
|
||||
n=0
|
||||
do i = 1 to Prim.0
|
||||
if Prim.i//4 = 3 then
|
||||
n=n+1
|
||||
else
|
||||
Prim.i=0
|
||||
end
|
||||
return n
|
||||
|
||||
GenerateBlum:
|
||||
procedure expose Prim. Blum.
|
||||
arg threshold
|
||||
Blum.=0; n=0
|
||||
do i = 1 to Prim.0
|
||||
if Prim.i <> 0 then do
|
||||
do j = i+1 to Prim.0
|
||||
if Prim.j <> 0 then do
|
||||
p=Prim.i*Prim.j
|
||||
if p > threshold then
|
||||
leave j
|
||||
n=n+1; Blum.p=1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return n
|
||||
|
||||
Results:
|
||||
procedure expose Blum.
|
||||
arg threshold,count
|
||||
n=0; digs.=0
|
||||
do i = 5 by 4 to threshold
|
||||
if \ Blum.i then
|
||||
iterate i
|
||||
n=n+1
|
||||
if n > count then
|
||||
leave i
|
||||
d=Right(i,1); digs.d=digs.d+1
|
||||
if n < 51 then do
|
||||
if n = 1 then
|
||||
say 'The first 50 are'
|
||||
call CharOut ,Right(i,4)
|
||||
if n//10 = 0 then
|
||||
say
|
||||
if n = 50 then
|
||||
say
|
||||
iterate i
|
||||
end
|
||||
if n = 26828 | n//100000 = 0 then
|
||||
say 'The' n'th is' i
|
||||
if n = count then do
|
||||
say
|
||||
say 'Percent distribution of the first' count
|
||||
do i = 1 to 9
|
||||
if digs.i > 0 then
|
||||
say format(digs.i*100/count,2,3)'% ends in' i
|
||||
end
|
||||
end
|
||||
end
|
||||
say
|
||||
return 0
|
||||
|
||||
include Math
|
||||
Loading…
Add table
Add a link
Reference in a new issue