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

 
Output of file : APRT-CL.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˜
bdŸÞñB
Žn˜dim IN%(55440),F%(55440),FI%(55440)
¯s¤‚INñÐ\)‚FñÐ\)‚FIñÐ\)
ôx¤‚Pñ)‚NPñ)„Qñ<)‚NQñ)‚Gñ<)„Tñ)‚Zñ)
0‚¤„JSñ)„JWñ)„JXñ)„J0ñ)„J1ñ)„J2ñ)
CŒ¤„JñÂñ)
L–˜
f œñÂñÂñÂñÂñ
|ªœñÂñÂñÂñ
š´œñÂñÂñÂñÂñ
Âñ
¸¾œñ ÂñÂñÂñÂñ=Âñ
ÖÈœñÂñÂñ%ÂñÂñµÂñ
4ÒœñGÂñÂñ+ÂñÂñÓÂñÂñÂñÂñwÂñÂñÂñÂñ¥ÂñÂñ)ÂñÂñÂñÂñIÂñÂñÙ Âñ
bÜœñÂñÂñqÂñÂñQÂñ
ÂññÂñÂññÂñ
°æœñ{ÂñÂñÂñÂñmÂñÂñõÂñÂñÂñÂñ‰Âñ
Âñ±ÂñÂñqÂñÂñ;Âñ
ðœñÂñÂñCÂñÂñÏÂñÂñKÂñÂñ ÂñÂñÇÂñÂñßÂñÂñ?ÂñÂñ› Âñ
Âñ•Âñ
Túœñ
ÂñÂñÂñÂñ} ÂñÂñYÂñÂñiÂñÂñ)Âñ
Âñ$Âñ
ÂñI ÂñÂñù@Âñ
ˆ˜data 881,3,3697,5,18481,13,55441,38,23761,7
® œñqÂñÂñqÂñÂñ1HÂñ
ÂñÑ\Âñ
·˜
ʉIÑñŠñ
Ú"›‚PI)
á,Œ
ø6˜for I%=1 to 60
;‰IÑñŠñ;
%@›„QI)‚GI)
,JŒ
5T˜
R^§"Test number N="ÁƒN
ghƒNÔñŽñ¢

p|¨€š
y†˜
­„Tñ)ÑñïñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
åš„Tñ)ÑñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
!¤„Tñ)ÑñïñåñïñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
a®„Tñ)ÑñïñåñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
¡¸„Tñ)ÑñïñåñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ
á„Tñ)ÑñïñåñïñåñåñÀ‚NPñ)ÑñÀ‚NQñ)Ññ$
̘T(7)=2^4*3^3*5*7*11:NP%(7)=5:NQ%(7)=60
TÑ„Tñ)Ññïñåñïñåñåñåñ À‚NPñ)ÑñÀ‚NQñ)Ññ;
gÖ‰IÑñŠñ
uàƒSÑñ
Žê‰JÑñŠ‚NQI)
¢þƒQфQJ)
׃UфTI)À’ƒSåуQÀƒUуUèƒQ“£
öDƒSïñ҃NŽ”‰Â‰‡ñl
ýNŒ
 XŒ
* b™À™"This number is too large."À¿
a lƒTфTI)ÀNPтNPI)ÀNQсJÀSIсI
j v˜
… €™À™"Preparative test"
— ŠƒWруN)
­ ”ƒWуNŽñø
À žƒWÑðŽñ²
Õ ¨ƒWÖñŽñH

é ²™" Pass !"Á
ò ¼˜

Ƙ Main test

И
&
Ú‰IÑñŠNP
:
äPтPI)
J
SWLQ
m
ø™À™À™"Main test for P="ÁP

PÒñŽ
¯
À€ÚƒNPÞñPïñ)ÖñŽSWÑñ
È
‰JсLQÝñŠNQ
ë
ƒQфQJ)ÀGтGJ)
ú
*KÑÞñ

4ƒUуQÞñ
 >’
! H  K
5 \ ƒUуUèP
? f“£
R pKÑðŽñ
› zPKсPïKÀPLÑ(PÞñ)åPï(KÞñ)ÀPMсPï(KÞñ)
À „NQÒñ$ŽˆõIndex2ˆõFX2
Ý ŽÀˆõIndex1ˆõFX1
õ ¢„J0ðÁPKÞñ)Ñð

§¢„J1ðÁPKÞñ)Ñð
% ¶™" for Q="ÁƒQÁ
: ÀPÑñŽñè
Q ʁAÑñÀBÑñ
r ԍNQÒñ$Žˆõ
JacobiSum2
‹ ÞÀˆõ
JacobiSum1
 ã‡õJAC_PQV
º 荁KÑñŽõJAC_PQV
Ñ òAÑñÀBÑñ
ò üNQÒñ$Žˆõ
JacobiSum2

Àˆõ
JacobiSum1
#
¢„JWðÁPKÞñ)Ñð
@
KÑñŽõJAC_PQV
g
¢„JWðÁPMÞñ)Ñ¢„J0ðÁPMÞñ)
~
8AÑñÀBÑñ
Ÿ
BNQÒñ$Žˆõ
JacobiSum2
¸
LÀˆõ
JacobiSum1
ß
[¢„JSðÁPMÞñ)Ñ¢„J0ðÁPMÞñ)
ÿ
tˆõJS_JWˆõ NormalizeJS
&ƒ¢„J1ðÁPMÞñ)Ñ¢„JSðÁPMÞñ)
WœAÑñåñï(KÞñ)ÀBÑñï(KÞñ)
x«NQÒñ$Žˆõ
JacobiSum2
‘°Àˆõ
JacobiSum1
©µ¢„JWðÁPKÞñ)Ñð
п¢„JSðÁPMÞñ)Ñ¢„J0ðÁPMÞñ)
ï؈õJS_2ˆõ NormalizeJS
碄J2ðÁPMÞñ)Ñ¢„JSðÁPMÞñ)
˜
M
˜ J(p,q,v) ( J(v,i) )
V˜
gõJAC_PQV
Œ#¢„JðÁPKÞñÂñÁPKÞñ)Ñð
¨K¢„JðÁPKÞñÂð)Ññ
»ZˆõInverseX
ÐdPÑñŽñ†
æn‰VÑðŠPKÞñ
x €çVVçPÑð}Žñr
Œ ‰XÑñŠPKÞñ
G› ¢„JSðÁPKÞñ)Ñ¢„J0ðÁPKÞñ)
_´ XçPÑðŽñh
}¾ VÑðŽƒEсXÀ‡ñÜ
˜È ƒEÑ(VåX)èPK
«Ò ƒEÑðŽñh
ºÜ ˆõJS_E
Òë ¢„JWðÁPKÞñ)Ñð
è𠉁I1ÑðŠPKÞñ
ú
SÑ(I1å‚ZX))çPK
+
„JWS)фJWS)݄JSI1)
2 Œ
H ˆõ NormalizeJW
t' ¢„JSðÁPKÞñ)Ñ¢„JVÂðÁPKÞñ)
„@ ˆõJS_JW
°O ¢„JVÂðÁPKÞñ)Ñ¢„JSðÁPKÞñ)
»h ŒX
ÆrŒV
Ð|‡ñ
†KÑñŽ„JðÂð)уQÀ„JñÂð)ÑñÀ‡ñ
KÒñŽñD
!š˜
R¤˜ J(2,q,v) k=2 ( J(v,i) )
[®˜
o¸„JñÂð)Ññ
€Â‰I1ÑðŠñ
™Ì „JSI1)фJ0I1)
 ÖŒ
¯àˆõJS_2
ÀꉁI1ÑðŠñ
Ýô „JñI1)фJSI1)
äþŒ
õ‰I1ÑðŠñ
 „JðI1)фJSI1)åƒQ
Œ
&&‡ñ
/0˜
`:˜ J(2,q,v) k>2 ( J(v,i) )
iD˜
N‰VÑðŠPKÞñ
b €çV€æV)}ŽñÔ
¹l ‰XÑñŠPKÞñ‹ñ
Øq ¢„JSðÁPM)Ñ¢„J1ðÁPM)
” €èXçñÑñXçñÑñ}Žñ\
¨ VÑðŽƒEсX
;² ÀƒEÑ(VåX)èPK
O¼ÀƒEÑðŽñ\
^Æ ˆõJS_E
vÕ ¢„JWðÁPKÞñ)Ñð
ŒÚ ‰I1ÑðŠPKÞñ
Š
SÑ(I1å‚ZX))çPK
Æî
„JWS)ÝфJSI1)
Íø Œ
ã ˆõ NormalizeJW
 ¢„JSðÁPKÞñ)Ñ¢„JVÂðÁPKÞñ)
%* ˆõ NormalizeJS
54 ˆõJS_JW
a9 ¢„JVÂðÁPKÞñ)Ñ¢„JSðÁPKÞñ)
l\ ŒX
žf €èVÑðVçñÑñVçñÑñ}ŽñÔ
¶† ¢„JWðÁPKÞñ)Ñð
Έ ¢„JSðÁPKÞñ)Ñð
õ‰ ¢„JWðÁPMÞñ)Ñ¢„J2ðÁPMÞñ)
!“ ¢„JSðÁPMÞñ)Ñ¢„JVÂðÁPMÞñ)
1¬ ˆõJS_JW
]± ¢„JVÂðÁPMÞñ)Ñ¢„JSðÁPMÞñ)
hÔŒV
qޘ
’è˜ J(0,p,q)^u*J(v,p,q)
›ò˜
³ ¢„JSðÁPKÞñ)Ñð
Ç VуNçPK
Û ƒUуNèPK
 ¢„JSðÁPLÞñ)Ñ¢„JðÂðÁPLÞñ)
8 ƒEуUÀˆõJS_E
5G ¢„JWðÁPKÞñ)Ñð
KL ‰I1ÑðŠPLÞñ
aV ‰J1ÑðŠPLÞñ
|` SÑ(I1݁J1)çPK
µj „JWS)Ñ(„JWS)݄JSI1)å„JVJ1))çƒN
¼t Œ
Ã~ Œ
Ùˆ ˆõ NormalizeJW
ï’ ‰I1ÑðŠPLÞñ
œ „JWI1)çуN
¦ Œ
° ƒWÑð
-º ‰I1ÑðŠPLÞñ
BÄ ƒWÝфJWI1)
IÎ Œ
[Ø ƒWÑñŽ
râ À‰I1ÑðŠPLÞñ
œì À„JWI1)ÑñŽHсI1À”‰‡ñ–
À—
¤ö ÀŒ
Ð
ƒWÖ(ƒNÞñ)å(PÞñ)Ž”‰Â‰‡ñ

æ

‰I1ÑðŠPMÞñ

„JWI1)уNÞñŽ”‰‡ñ<


(
”‰Â‰‡ñ

22
KÑñŽñn
J<
‰I2ÑñŠPÞñ
nF
SсI1݁I2åPï(KÞñ)
”P
„JWS)փNÞñŽ”‰Â‰Â‰‡ñ

›Z

¿d
HсI1݁Pï(KÞñ)À‡ñ–
×n
‰I2ÑñŠPÞñ
ýx
„JWI2)փNÞñŽ”‰Â‰Â‰‡ñ

‚

Œ
HсPÞñ
,–
SWÑñŽñ
Dª
HçPÑðŽñ
c´
PÖñŽSWÑñÀ‡ñ
x¾
KÖñŽñÜ
›È
ƒNçñÑñŽSWÑñÀ‡ñ
¥Ò
‡ñ
¹Ü
€æH)Žñ
ðæ
PLÑñÀPKÑñÀ„JSð)уQÀƒEÑ(ƒNÞñ)èñ
ÿð
ˆõJS_E
%ú
„JSð)çƒNփNÞñŽ”‰Â‰‡ñ

3 SWÑñ
> ŒJ
g SWŽLQÑðLQсJÞñÀ‡ñ"
r ŒI
| ‡ñX
… ˜
" NQԂNQSI)Ž
­' À™"retry"Á
È, À NQÀƒQфQNQ)
ùJ ÀƒUуTÀ’ƒSåуQÀƒUуUèƒQ“£
š À‡ñ
¤ ”‰
$© SIÑñŽ”‰‡ñf

Fª ™"retry from the beginning"Á
o®  SIÀƒTфTSI)ÀNPтNPSI)
} ƒSÑñ
–Ì ‰JÑñŠ‚NQSI)
ªÖ ƒQфQJ)
Úà ƒUуTÀ’ƒSåуQÀƒUуUèƒQ“£
øê ƒSïñ҃NŽ”‰À‡ñ
ÿô Œ
 –
 NQсJ
& ‡ñÚ
(: ˜
AD ˜ Final test
JN ˜
aX ™À™À™"Final test"
ob ƒRÑñ
l T1уTèñ'ÀT2уTçñ'
£v T1ÑðŽñÆ
µ€ ‰I1ÑðŠT1
ÈŠ ‰I2ÑñŠñ'
á” ƒRуRåƒNçƒS
ûž ƒRÑñŽ”‰Â‰‡ñø
1¨ €çƒNçƒRÑðƒRԃN}ŽƒWуRÀ”‰Â‰‡ñH

8² Œ
?¼ Œ
SÆ ‰I1ÑñŠT2
lÐ ƒRуRåƒNçƒS
„Ú ƒRÑñŽ”‰‡ñø
¸ß €çƒNçƒRÑðƒRԃN}ŽƒWуRÀ”‰‡ñH

¿ä Œ
Èî ˜
Üø ™" Pass !"
õ
™À™ƒNÁ"is prime."
ÿ
‡ñÀ




™À™" Not pass !"
<*
™À™ƒNÁ"is not prime."
F4
‡ñÀ

O>

dH
™" Not pass !"
R
™À™ƒNÁ"is a multiple of"ÁƒWÁ"."
—\
‡ñÀ

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

k ¢
™" Please input once more !"
u ¬
‡ñ^
~ ¶

‰ À
™€šÀ¿
’ Ê

› Ô

¹ Þ
˜ subroutine part
 è

ã ò
˜ FOR table of index
ì ü

ü õIndex1
! ºI
!WÑñ
-!‰IÑñŠƒQÞñ
F!$WсWåGçƒQ
Z!.‚INW)сI
a!8Œ
h!B•
q!L˜
‘!V˜ FOR table of F(x)
š!`˜
§!jõFX1
²!oºI
À!tWÑñ
Ø!~‰IÑñŠƒQÞñ
ñ!ˆWсWåGçƒQ
"’‚FI)тIN(ñށW)çƒQ)
"œŒ
#"¦•
,"°˜
D"º˜ Jacobi sum
M"Ę
a"Îõ
JacobiSum1
v"кIJK
Ž"Ó¢„J0ðÁPLÞñ)Ñð
¦"ö‰IÑñŠƒQÞñ
Ð"JÑ(AåI݁Bå‚FI))çPK
í"
JԁPLŽ „J0J)
#À‰KÑñŠPÞñÀ¡„J0JށKåPM)ÀŒ
'#2Œ
.#<•
7#F˜
_#P˜ FOR table of index part2
h#Z˜
x#dõIndex2
ƒ#iºƒX
‘#nƒWÑñ
©#x‰ƒXÑñŠƒQÞñ
Â#‚ƒWуWåGçƒQ
â#ŒƒXÔñ'Ž‚INƒW)уX
$–À‚FIƒW)уXèñ'À‚INƒW)Ñ£
$ Œ
$ª•
!$´˜
G$¾˜ 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
ÿ$ú‚FƒX)тIN(ñރW)çƒQ)
,%‚FIƒX)ÝтFI(ñރW)çƒQ)çñdåñd
3%Œ
:%•
C%"˜
z%,˜ Jacobi sum part2 ( J0=J(X^A%,X^B%) )
ƒ%6˜
—%@õ
JacobiSum2
¬%BºƒXJK
Ä%E¢„J0ðÁPLÞñ)Ñð
Ü%h‰ƒXÑñŠƒQÞñ
&rJÑ(AåƒX݁Bå(‚FIƒX)èñdåñ'݂FƒX)))çPK
7&|JԁPLŽ „J0J)
j&†À‰KÑñŠPÞñÀ¡„J0JށKåPM)ÀŒ
q&¤Œ
x&®•
&¸˜
¶&˜ X^(-1) (mod P^k) ( Z%(x)=X^(-1) )
¿&̘
Ñ&ÖõInverseX
Ü&ÛºI
ô&à‰IÑñŠPKÞñ
+'ꍁIçPŽ‚ZI)рہIPK)‚ZI)Ñð
2'þŒ
9'•
B'˜
W'˜ JS=JS^E
`'&˜
n'0õJS_E
y'5ºI
Ž':ƒEÑñŽñž
µ'I¢„JWðÁPLÞñ)Ñ¢„JSðÁPLÞñ)
Ä'bˆõJS_2
ä'l‰IрƒE)ÞñŠñ‹Þñ
(v€ÃIƒE)ŽˆõJS_JW
(€ˆõJS_2
(ŠŒ
7(”€ÃðƒE)ŽˆõJS_JW
>(ž•
G(¨˜
](²˜ JS=JS*JW
f(¼˜
u(ÆõJS_JW
Š(˺IJK
 (ЉIÑðŠPLÞñ
¶(Ú‰JÑðŠPLÞñ
Ñ(ä KÑ(I݁J)çPK
)î „JXK)Ñ(„JXK)݄JSI)å„JWJ))çƒN
)øŒ
)Œ
:)¢„JSðÁPKÞñ)Ñ¢„JXðÁPKÞñ)
R)¢„JXðÁPKÞñ)Ñð
h)*ˆõ NormalizeJS
o)4•
x)>˜
)H˜ JS=JS*2
–)R˜
¤)\õJS_2
¹)aºIJK
Ï)f‰IÑðŠPLÞñ
ç)pKÑñåIçPK
*z„JXK)Ñ(„JXK)݄JSI)ïñ)çƒN
*„Œ
2*Ž‰IÑðŠPLÞñ
O*˜‰JсIÝñŠPLÞñ
j*¢ KÑ(I݁J)çPK
¢*¬ „JXK)Ñ(„JXK)Ýñå„JSI)å„JSJ))çƒN
©*¶Œ
°*ÀŒ
×*Ï¢„JSðÁPKÞñ)Ñ¢„JXðÁPKÞñ)
ï*Ù¢„JXðÁPKÞñ)Ñð
+èˆõ NormalizeJS
+ò•
+œ˜
>+¦˜ normalize coefficient of JS
G+°˜
\+ºõ NormalizeJS
l+¿ºIJ
…+ĉIсPLŠPKÞñ
¦+΍„JSI)ŽƒJWфJSI)
¿+Ø À‰JÑñŠPÞñ
ß+ì À„JSIށJåPM)ÞуJW
ç+ö ÀŒ
ø+ À¨„JSI)
ÿ+
Œ
,•
,˜
8,(˜ normalize coefficient of JW
A,2˜
V,<õ NormalizeJW
f,AºIJ
,F‰IсPLŠPKÞñ
 ,P„JWI)ŽƒJWфJWI)
¹,Z À‰JÑñŠPÞñ
Ù,n À„JWIށJåPM)ÞуJW
á,x ÀŒ
ò,‚ À¨„JWI)
ù,ŒŒ
-–•


  3 Responses to “Category : BASIC Source Code
Archive   : UBAS830.ZIP
Filename : APRT-CL.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/