Data update

This commit is contained in:
Ingy döt Net 2024-11-04 20:28:54 -08:00
parent 52a6ef48dd
commit 157b70a810
604 changed files with 14253 additions and 2100 deletions

View file

@ -1,22 +1,23 @@
/*REXX program determines if any integer (or a range of integers) is/are semiprime. */
/*REXX program determines if any integer (or a range of integers) is/are semiprime. */
include Settings
say version; say 'Semi primes'; say
say version; say 'Semi Primes'; say
parse arg bot top . /*obtain optional arguments from the CL*/
if bot=='' | bot=="," then bot=random() /*None givenqq User wants us to guess.*/
if bot=='' | bot=="," then bot=Random() /*None givenqq User wants us to guess.*/
if top=='' | top=="," then top=bot /*maybe define a range of numbers. */
tell= (top>0) /*should results be shown to the termqq */
w=max(length(bot), length(top)) /*obtain the maximum width of numbers. */
numeric digits max(9, w) /*ensure there're enough decimal digits*/
hh=0 /*initialize number of semiprimes found*/
do n=abs(bot) to abs(top) /*show results for a range of numbers. */
w=Max(Length(bot), Length(top)) /*obtain the maximum width of numbers. */
numeric digits Max(9, w) /*ensure there're enough decimal digits*/
hh=0 /*initialize Number of semiprimes found*/
do n=Abs(bot) to Abs(top) /*show results for a range of numbers. */
qq=IsSemiPrime(n); hh=hh+qq /*Is N a semiprimeqq; Maybe bump counter*/
if tell then say right(n,w) right(word("isn't" 'is', qq+1), 6) 'semiprime.' '('format(time('e'),,3) 'seconds)'
call time('r')
if tell then say Right(n,w) Right(Word("isn't" 'is', qq+1), 6) 'Semiprime.' '('Format(Time('e'),,3) 'seconds)'
call Time('r')
end /*n*/
say
if bot\==top then say 'found ' hh " semiprimes."
say format(time('e'),,3) ' seconds'
say Format(Time('e'),,3) ' seconds'
exit /*stick a fork in it, we're all done. */
IsSemiprime:
@ -35,7 +36,7 @@ end
/* Wheeled scan */
do i = 2 for 2
if x//i = 0 then
if IsPrime(x%i) then
if Prime(x%i) then
return 1
else
return 0
@ -43,7 +44,7 @@ end
do i = 5 by 6 until i*i > x
do j = i by 2 for 2
if x//j==0 then
if IsPrime(x%j) then
if Prime(x%j) then
return 1
else
return 0