Category : BASIC Source Code
Archive   : UBAS830.ZIP
Filename : APRT-EMA.UB

 
Output of file : APRT-EMA.UB contained in archive : UBAS830.ZIP

˜æ
˜
R˜ Primary testing program "APRT°CL" version 1.4
”(˜ Cohen-Lenstra version of Adleman-Pomerance-Rumely Test
Î2˜ programed by Koichiro Akiyama
×<˜
F˜ 1988 2 12
G˜
!J˜
hK˜ modified for UBASIC version 7 by Yuji KIDA
 L˜ 1989 1 31
ØM˜ 1989 3 30

N˜ remedied by Frank O'Hara
EO˜ 1990 1 28
NP˜
WZ˜
idŸÞñBÀ€«ÞñB
•n˜$dim IN%(55440),F%(55440),FI%(55440)
¶s¤‚INñÐ\)‚FñÐ\)‚FIñÐ\)
ûx¤‚Pñ)‚NPñ)„Qñ<)‚NQñ)‚Gñ<)„Tñ)‚Zñ)
?‚¤€õñ)€õñÁñ)€õñÁñ)€õñÁñ)€õñÁñ)€õñÁñ)
TŒ¤€õñÁñÂñ)
]–˜ì
w œñÂñÂñÂñÂñ
ªœñÂñÂñÂñ
«´œñÂñÂñÂñÂñ
Âñ
ɾœñ ÂñÂñÂñÂñ=Âñ
çÈœñÂñÂñ%ÂñÂñµÂñ
EÒœñGÂñÂñ+ÂñÂñÓÂñÂñÂñÂñwÂñÂñÂñÂñ¥ÂñÂñ)ÂñÂñÂñÂñIÂñÂñÙ Âñ
sÜœñÂñÂñqÂñÂñQÂñ
ÂññÂñÂññÂñ
Áæœñ{ÂñÂñÂñÂñmÂñÂñõÂñÂñÂñÂñ‰Âñ
Âñ±ÂñÂñqÂñÂñ;Âñ
ðœñÂñÂñCÂñÂñÏÂñÂñKÂñÂñ ÂñÂñÇÂñÂñßÂñÂñ?ÂñÂñ› Âñ
Âñ•Âñ
eúœñ
ÂñÂñÂñÂñ} ÂñÂñYÂñÂñiÂñÂñ)Âñ
Âñ$Âñ
ÂñI ÂñÂñù@Âñ
™˜(data 881,3,3697,5,18481,13,55441,38,23761,7
¿ œñqÂñÂñqÂñÂñ1HÂñ
ÂñÑ\Âñ
ȘW
Û‰IÑñŠñ
ë"›‚PI)
ò,Œ
6˜˜for I%=1 to 60
;‰IÑñŠñ;
6@›„QI)‚GI)
=JŒ
FT˜Õ
c^§"Test number N="ÁƒN
xhƒNÔñŽñ¢

|¨€š
Š†˜
¾„Tñ)ÑñïñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
öš„Tñ)ÑñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
2¤„Tñ)ÑñïñåñïñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
r®„Tñ)ÑñïñåñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
²¸„Tñ)ÑñïñåñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
ò„Tñ)ÑñïñåñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ$
!̘°T(7)=2^4*3^3*5*7*11:NP%(7)=5:NQ%(7)=60
eÑ„Tñ)Ññïñåñïñåñåñåñ À‚NPñ)ÑñÀ‚NQñ)Ññ;
xÖ‰IÑñŠñ
†àƒSÑñ
Ÿê‰JÑñŠ‚NQI)
³þƒQфQJ)
èƒUфTI)À’ÿÿƒSåуQÀƒUуUèƒQ“Z£
 D–ƒSïñ҃NŽ”‰Â‰‡ñl
 NŒ
 XŒ
; b™À™"This number is too large."À¿
r lƒTфTI)ÀNPтNPI)ÀNQсJÀSIсI
{ v˜

– €™À™"Preparative test"
¨ ŠƒWруN)
¾ ”MƒWуNŽñø
Ñ žƒWÑðŽñ²
æ ¨ƒWÖñŽñH

ú ²™" Pass !"Á

¼˜²

Ƙ Main test
#
И
7
Ú‰IÑñŠNP
K
äPтPI)
[
SWLQ
~
ø™À™À™"Main test for P="ÁP

OPÒñŽ
À
ÀO€ÚƒNPÞñPïñ)ÖñŽSWÑñ
Ù
‰JсLQÝñŠNQ
ü
ƒQфQJ)ÀGтGJ)
*KÑÞñ
 4ƒUуQÞñ
' >’ÿÿ
2 H  K
F \ ƒUуUèP
P f“¶£
c pòKÑðŽñ
¬ zPKсPïKÀPLÑ(PÞñ)åPï(KÞñ)ÀPMсPï(KÞñ)
Ñ „jNQÒñ$ŽˆõIndex2ˆõFX2
î ŽÀˆõIndex1ñˆõFX1~ð
 ¢€õñÁðÁPKÞñ)Ñð
" §¢€õñÁðÁPKÞñ)Ñð
: ¶™" for Q="ÁƒQÁ
O ÀÞPÑñŽñè
f ʁAÑñÀBÑñ
‡ ԍ NQÒñ$Žˆõ
JacobiSum2
  ÞÀˆõ
JacobiSum1oñ
² ã‡õJAC_PQV
Ï è^KÑñŽõJAC_PQV
æ òAÑñÀBÑñ

ü NQÒñ$Žˆõ
JacobiSum2

Àˆõ
JacobiSum1oñ
:
¢€õñÁðÁPKÞñ)Ñð
W
KÑñŽõJAC_PQV
‚
¢€õñÁðÁPMÞñ)Ñ¢€õñÁðÁPMÞñ)
™
8AÑñÀBÑñ
º
BNQÒñ$Žˆõ
JacobiSum2
Ó
LÀˆõ
JacobiSum1
ú
[¢€õðÁPMÞñ)Ñ¢€õñÁðÁPMÞñ)
tˆõJS_JWˆõ NormalizeJS
Aƒ¢€õñÁðÁPMÞñ)Ñ¢€õðÁPMÞñ)
rœAÑñåñï(KÞñ)ÀBÑñï(KÞñ)
“«NQÒñ$Žˆõ
JacobiSum2
¬°Àˆõ
JacobiSum1
Ƶ¢€õñÁðÁPKÞñ)Ñð
í¿¢€õðÁPMÞñ)Ñ¢€õñÁðÁPMÞñ)
؈õJS_2ˆõ NormalizeJS
3碀õñÁðÁPMÞñ)Ñ¢€õðÁPMÞñ)
<˜
j
˜ J(p,q,v) ( J(v,i) )
s˜
„õJAC_PQV
«#¢€õñÁðÁPKÞñÂñÁPKÞñ)Ñð
ÉK¢€õñÁðÁPKÞñÂð)Ññ
ÜZˆõInverseXSñ
ñd€PÑñŽñ†
n‰VÑðŠPKÞñ
)x ¸€ç´VVçPÑð}Žñr
AŒ ‰XÑñŠPKÞñ
h› ¢€õðÁPKÞñ)Ñ¢€õñÁðÁPKÞñ)
€´ XçPÑðŽñh
ž¾ -VÑðŽƒEсXÀ‡ñÜ
¹È ƒEÑ(VåX)èPK
ÌÒ [ƒEÑðŽñh
ÛÜ ˆõJS_E³ð
õë ¢€õñÁðÁPKÞñ)Ñð
𠉁I1ÑðŠPKÞñ
+ú
SÑ(I1å‚ZX))çPK
E
€õñÁS)ÝрõI1)
L Œ
b ˆõ NormalizeJW¾ñ
Ž' ¢€õðÁPKÞñ)Ñ¢€õñÁVÂðÁPKÞñ)
ž@ ˆõJS_JWèð
ÊO ¢€õñÁVÂðÁPKÞñ)Ñ¢€õðÁPKÞñ)
Õh ŒX
àrŒV
ê|‡ñ
!†°KÑñŽ€õñÁðÂð)уQÀ€õñÁñÂð)ÑñÀ‡ñ
6ÅKÒñŽñD
?š˜
p¤˜ J(2,q,v) k=2 ( J(v,i) )
y®˜
¸€õñÁñÂð)Ññ
 Â‰I1ÑðŠñ
¹Ì €õI1)рõñÁI1)
ÀÖŒ
ÏàˆõJS_2Íð
àꉁI1ÑðŠñ
ýô €õñÁñI1)рõI1)
þŒ
‰I1ÑðŠñ
5 €õñÁðI1)рõI1)åƒQ
<Œ
F&‡ñ
O0˜
€:˜ J(2,q,v) k>2 ( J(v,i) )
‰D˜
ŸN‰VÑðŠPKÞñ
½b €çV€æV)}ŽñÔ
Ùl ‰XÑñŠPKÞñ‹ñ
øq ¢€õðÁPM)Ñ¢€õñÁðÁPM)
#” €èXçñÑñXçñÑñ}Žñ\
<¨ VÑðŽƒEсX
[² ÀƒEÑ(VåX)èPK
o¼ÀƒEÑðŽñ\
~Æ ˆõJS_E
˜Õ ¢€õñÁðÁPKÞñ)Ñð
®Ú ‰I1ÑðŠPKÞñ
Îä
SÑ(I1å‚ZX))çPK
èî
€õñÁS)ÝрõI1)
ïø Œ
 ˆõ NormalizeJW
1 ¢€õðÁPKÞñ)Ñ¢€õñÁVÂðÁPKÞñ)
G* ˆõ NormalizeJS
W4 ˆõJS_JW
ƒ9 ¢€õñÁVÂðÁPKÞñ)Ñ¢€õðÁPKÞñ)
Ž\ ŒX
Àf €èVÑðVçñÑñVçñÑñ}ŽñÔ
Ú† ¢€õñÁðÁPKÞñ)Ñð
ðˆ ¢€õðÁPKÞñ)Ñð
‰ ¢€õñÁðÁPMÞñ)Ñ¢€õñÁðÁPMÞñ)
G“ ¢€õðÁPMÞñ)Ñ¢€õñÁVÂðÁPMÞñ)
W¬ ˆõJS_JW
ƒ± ¢€õñÁVÂðÁPMÞñ)Ñ¢€õðÁPMÞñ)
ŽÔŒV
—Þ˜
¸è˜ J(0,p,q)^u*J(v,p,q)
Áò˜
× ¢€õðÁPKÞñ)Ñð
ë VуNçPK
ÿ ƒUуNèPK
( ¢€õðÁPLÞñ)Ñ¢€õñÁðÂðÁPLÞñ)
A8 ƒEуUÀˆõJS_E³ð
[G ¢€õñÁðÁPKÞñ)Ñð
qL ‰I1ÑðŠPLÞñ
‡V ‰J1ÑðŠPLÞñ
¢` SÑ(I1݁J1)çPK
ßj €õñÁS)Ñ(€õñÁS)݀õI1)å€õñÁVJ1))çƒN
æt Œ
í~ Œ
ˆ ˆõ NormalizeJW¾ñ
’ ‰I1ÑðŠPLÞñ
0œ €õñÁI1)çуN
7¦ Œ
C° ƒWÑð
Yº ‰I1ÑðŠPLÞñ
pÄ ƒWÝрõñÁI1)
wÎ Œ
‰Ø c%ƒWÑñŽ
 â À‰I1ÑðŠPLÞñ
Ìì À[%€õñÁI1)ÑñŽHсI1À”‰‡ñ–
À—
Ôö ÀŒ

%ƒWÖ(ƒNÞñ)å(PÞñ)Ž”‰Â‰‡ñ



‰I1ÑðŠPMÞñ
:
€õñÁI1)уNÞñŽ”‰‡ñ<
A

O(
”‰Â‰‡ñ

d2
KÑñŽñn
|<
‰I2ÑñŠPÞñ
 F
SсI1݁I2åPï(KÞñ)
ÈP
W&€õñÁS)փNÞñŽ”‰Â‰Â‰‡ñ

ÏZ

ód
HсI1݁Pï(KÞñ)À‡ñ–
n
‰I2ÑñŠPÞñ
3x
€õñÁI2)փNÞñŽ”‰Â‰Â‰‡ñ

:‚

MŒ
HсPÞñ
b–
ñ&SWÑñŽñ
zª
 'HçPÑðŽñ
™´
('PÖñŽSWÑñÀ‡ñ
®¾
='KÖñŽñÜ
ÑÈ
`'ƒNçñÑñŽSWÑñÀ‡ñ
ÛÒ
‡ñ
ïÜ
~'€æH)Žñ
$æ
PLÑñÀPKÑñÀ€õð)уQÀƒEÑ(ƒNÞñ)èñ
3ð
ˆõJS_E³ð
Wú
æ'€õð)çƒNփNÞñŽ”‰Â‰‡ñ

e SWÑñ
p ŒJ
™ (SWŽLQÑð((LQсJÞñÀ‡ñ"
¤ ŒI
® ‡ñX
· ˜
Ï" Å(NQԂNQSI)Ž
ß' À™"retry"Á
ú, À NQÀƒQфQNQ)
+J ÀƒUуTÀ’ÿÿƒSåуQÀƒUуUèƒQ“(£
6š À‡ñ
>¤ ”‰
V© å(SIÑñŽ”‰‡ñf

xª ™"retry from the beginning"Á
¡®  SIÀƒTфTSI)ÀNPтNPSI)
¯ ƒSÑñ
ÈÌ ‰JÑñŠ‚NQSI)
ÜÖ ƒQфQJ)
à ƒUуTÀ’ÿÿƒSåуQÀƒUуUèƒQ“~)£
*ê ¹)ƒSïñ҃NŽ”‰À‡ñ
1ô Œ
8 –
G NQсJ
Q& ‡ñÚ
Z: ˜
sD ˜ Final test
|N ˜
“X ™À™À™"Final test"
¡b ƒRÑñ
Âl T1уTèñ'ÀT2уTçñ'
Õv T1ÑðŽñÆ
ç€ ‰I1ÑðŠT1
úŠ ‰I2ÑñŠñ'
” ƒRуRåƒNçƒS
-ž ƒRÑñŽ”‰Â‰‡ñø
c¨ €çƒNçƒRÑðƒRԃN}ŽƒWуRÀ”‰Â‰‡ñH

j² Œ
q¼ Œ
…Æ ‰I1ÑñŠT2
žÐ ƒRуRåƒNçƒS
¶Ú E+ƒRÑñŽ”‰‡ñø
êß y+€çh+ƒNçƒRÑðƒRԃN}ŽƒWуRÀ”‰‡ñH

ñä Œ
úî ˜
ø ™" Pass !"
'
™À™ƒNÁ"is prime."
1
‡ñÀ

:

Q
™À™" Not pass !"
n*
™À™ƒNÁ"is not prime."
x4
‡ñÀ

>

–H
™" Not pass !"
¿R
™À™ƒNÁ"is a multiple of"ÁƒWÁ"."
É\
‡ñÀ

àf
™" Not pass !"
öp
™À™"I'm sorry !"
3 z
™" I can't find whether this number is prime or not."
O „
™À™"test number="ÁƒN
p Ž
™À™"Please try other test."
z ˜
‡ñÀ

 ¢
™" Please input once more !"
§ ¬
‡ñ^
° ¶

» À
™€šÀ¿
Ä Ê

Í Ô

ë Þ
˜ subroutine part
ô è

!ò
˜ FOR table of index
!ü

.!õIndex1
9! ºI
G!WÑñ
_!‰IÑñŠƒQÞñ
x!$WсWåGçƒQ
Œ!.‚INW)сI
“!8Œ
š!B•
£!L˜
Ã!V˜ FOR table of F(x)
Ì!`˜
Ù!jõFX1
ä!oºI
ò!tWÑñ
"~‰IÑñŠƒQÞñ
#"ˆWсWåGçƒQ
G"’‚FI)тIN(ñށW)çƒQ)
N"œŒ
U"¦•
^"°˜
v"º˜ Jacobi sum
"Ę
“"Îõ
JacobiSum1
¨"кIJK
Â"Ó¢€õñÁðÁPLÞñ)Ñð
Ú"ö‰IÑñŠƒQÞñ
#JÑ(AåI݁Bå‚FI))çPK
##
¼/JԁPLŽ €õñÁJ)
X#Àç/‰KÑñŠPÞñÀ¡€õñÁJށKåPM)ÀŒ
_#2Œ
f#<•
o#F˜
—#P˜ FOR table of index part2
 #Z˜
°#dõIndex2
»#iºƒX
É#nƒWÑñ
á#x‰ƒXÑñŠƒQÞñ
ú#‚ƒWуWåGçƒQ
$ŒƒXÔñ'Ž‚INƒW)уX
B$–À‚FIƒW)уXèñ'À‚INƒW)Ñ£
I$ Œ
P$ª•
Y$´˜
$¾˜ FOR table of F(x) part2
³$Ø ( F%(x)=F(x)@10^4 , FI%(x)=F(x)\10^4*100)
¼$Ș
É$ÒõFX2
Ô$׺ƒX
â$܃WÑñ
ú$扃XÑñŠƒQÞñ
%ðƒWуWåGçƒQ
7%ú‚FƒX)тIN(ñރW)çƒQ)
d%‚FIƒX)ÝтFI(ñރW)çƒQ)çñdåñd
k%Œ
r%•
{%"˜
²%,˜ Jacobi sum part2 ( J0=J(X^A%,X^B%) )
»%6˜
Ï%@õ
JacobiSum2
ä%BºƒXJK
þ%E¢€õñÁðÁPLÞñ)Ñð
&h‰ƒXÑñŠƒQÞñ
T&rJÑ(AåƒX݁Bå(‚FIƒX)èñdåñ'݂FƒX)))çPK
s&|JԁPLŽ €õñÁJ)
¨&†À‰KÑñŠPÞñÀ¡€õñÁJށKåPM)ÀŒ
¯&¤Œ
¶&®•
¿&¸˜
ô&˜ X^(-1) (mod P^k) ( Z%(x)=X^(-1) )
ý&̘
'ÖõInverseX
'ÛºI
2'à‰IÑñŠPKÞñ
i'êí3IçPŽ‚ZI)рہIPK)ø3‚ZI)Ñð
p'þŒ
w'•
€'˜
•'˜ JS=JS^E
ž'&˜
¬'0õJS_E
·'5ºI
Ì':[4ƒEÑñŽñž
ó'I¢€õñÁðÁPLÞñ)Ñ¢€õðÁPLÞñ)
(bˆõJS_2Íð
"(l‰IрƒE)ÞñŠñ‹Þñ
B(vÑ4€ÃIƒE)ŽˆõJS_JWèð
Q(€ˆõJS_2Íð
X(ŠŒ
u(”5€ÃðƒE)ŽˆõJS_JWèð
|(ž•
…(¨˜
›(²˜ JS=JS*JW
¤(¼˜
³(ÆõJS_JW
È(˺IJK
Þ(ЉIÑðŠPLÞñ
ô(Ú‰JÑðŠPLÞñ
)ä KÑ(I݁J)çPK
G)î €õñÁK)Ñ(€õñÁK)݀õI)å€õñÁJ))çƒN
N)øŒ
U)Œ
|)¢€õðÁPKÞñ)Ñ¢€õñÁðÁPKÞñ)
–)¢€õñÁðÁPKÞñ)Ñð
¬)*ˆõ NormalizeJS¤ñ
³)4•
¼)>˜
Ñ)H˜ JS=JS*2
Ú)R˜
è)\õJS_2
ý)aºIJK
*f‰IÑðŠPLÞñ
+*pKÑñåIçPK
[*z€õñÁK)Ñ(€õñÁK)݀õI)ïñ)çƒN
b*„Œ
x*Ž‰IÑðŠPLÞñ
•*˜‰JсIÝñŠPLÞñ
°*¢ KÑ(I݁J)çPK
è*¬ €õñÁK)Ñ(€õñÁK)Ýñå€õI)å€õJ))çƒN
ï*¶Œ
ö*ÀŒ
+Ï¢€õðÁPKÞñ)Ñ¢€õñÁðÁPKÞñ)
7+Ù¢€õñÁðÁPKÞñ)Ñð
M+èˆõ NormalizeJS¤ñ
T+ò•
]+œ˜
†+¦˜ normalize coefficient of JS
+°˜
¤+ºõ NormalizeJS
´+¿ºIJ
Í+ĉIсPLŠPKÞñ
ê+΍Ç8€õI)ŽƒJWрõI)
,Ø À‰JÑñŠPÞñ
!,ì À€õIށJåPM)ÞуJW
),ö ÀŒ
8, À¨€õI)
?,
Œ
F,•
O,˜
x,(˜ normalize coefficient of JW
,2˜
–,<õ NormalizeJW
¦,AºIJ
¿,F‰IсPLŠPKÞñ
ä,PÉ9€õñÁI)ŽƒJWрõñÁI)
ý,Z À‰JÑñŠPÞñ
-n À€õñÁIށJåPM)ÞуJW
'-x ÀŒ
:-‚ À¨€õñÁI)
A-ŒŒ
H-–•


  3 Responses to “Category : BASIC Source Code
Archive   : UBAS830.ZIP
Filename : APRT-EMA.UB

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/