Category : BASIC Source Code
Archive   : UBAS830.ZIP
Filename : POLFACT2.UB

 
Output of file : POLFACT2.UB contained in archive : UBAS830.ZIP

˜POLFACT2 VER 2.0
$€®ÂÂð
,۬
3(™
h2™" * Polynomial factorization modulo a prime *"
<™" * gives irreducible factors explicitly *"
ÒF™" * use x or X for a variable *"
P™" * example : x^3+2*x^2+3*x+4 *"À™
Z˜
%d±"f(x)="Á…W
2n…U0Ñ""
IxIѲ…WÂ"xX")
‚IŽ…U0Ýр¼…WIÞñ)Ý"_X"À…Wр»…WIÝñÂå)À‡ñx
¦Œ…U0рý…U0݅W)
»–™À™"f(X)="Á…U0
Ë AutoswÑð
ÙªõModP
´™À™"--------------------------------------------"
A¾AutoswŽƒPр΁Autosw)À AutoswÀ‡ñú
Uȧ"Mod P="ÁƒP
fҍƒPÑðŽ¿
ÜÀ¯°ƒPÔðŽAutoswÑރPÀ‡ñ¾
¤æƒPրуP)Ž™
ÆðÀ™"not a prime"À€¤À‡õModP
àú™" modulo "ÁƒPÀ™
…XѳõPolfact2¡í(…U0ƒP)
,€Â…X)ÑðŽ™" constant"À‡õModp
Fˆõ PrintPolyÖí(…X)
U"‡õModp
^,˜
w6õ PrintPoly(…X)
‡@ºI…W
­J€þ…XÂñ)ÒñŽ™€þ…XÂñ)Á
ÈT‰IÑñŠ€Â…X)‹ñ
ê^…WÑ"("݀ü€þ…XI))Ý")"
.h€þ…XIÝñ)Ž…WÝÑ"^"݀»€ü€þ…XIÝñ)Ýñ)ÂñÂå)
SrIԀ…X)ÞñŽ…WÝÑ" * "
r|²ÆŽ²Æ݀…W)ÒñOŽ™
~†™…WÁ
‡ŒÀ™
Žš•
—¤˜
 ®˜
¾¸³õPolfact2(…U0ƒP)
ກIDeg…UÑð…Ansр½)
ó̤†Z²Û…U0))
Ö²‘уP
6à‰IÑðŠ²Û…U0)À€ÿ…UI)рÿ…U0I)çƒPÀŒ
QꍲۅU)ÕðŽ•(…Ans)
™ôƒCрÿ…U²ۅU))À…Ansр½ƒC)À…UæуCÀ˜RemoveConstFactor
ÆþˆõRemoveMultiFactor`î˜U# -> U# * MF#
Ϙ
þ˜get product of factors for each degree
˜
&ˆõMakeZPZ†í
(0DegÑñ
<:õ
DegreeLoop
VD…XѲ݀ąU…Z))
„N²Û…X)Ž…AnsÝѳõ IrredFactor@î(…X)
•XÀ…UèхX
·b²Û…U)ÕñåDegÝñŽñ”
ÊlˆõRaiseZPZ»í
Öv Deg
뀇õ
DegreeLoopx
ôŠ˜
”²Û…U)Ž…AnsÝхU
-žˆõ
SortResult%î(&…Ans)
6¨˜
T²˜ get multiple factors
]¼˜
wÆ…Xр½€þ…AnsÂñ))
Ð‰IÑñŠ€Â…Ans)
®ÚEÑðÀ…Zрþ…AnsI)
¿ä²Û…MF)Ž
éîÀ…MFç…ZÑðÀ…MFèхZÀ EÀ‘
ø…XÝр½…ZE)
Œ
 ²‘Ñð
•(…X)
( ˜
L*˜ power of polynomial mod U#
U4˜
t>³õ PolyPower(…Z…E)
„HºI…W
R…EÑðŽ•(€ûñ))
¬\…WхZ
Êf‰Iр…E)ÞñŠð‹Þñ
âp…WхWïñç…U
z€ÃI…E)Ž…WхWå…Zç…U
 „Œ
 Ž•(…W)
( ˜˜
I ¢˜ remove multiple factors
R ¬˜
m ¶õRemoveMultiFactor
| À…MFхU
Ÿ Ê…DUѲ܅U)À²Û…DU)ÑðŽ¶
Ô Ô…DUÑðŽ…WхUÀ…UÑñÀ‡ñ.À˜p æ‘½€Ž®
î Þ…GѲ݀ąU…DU))

荲ۅG)ÑðŽ¶À˜‘½dˆö”‚È‚µ
2
òÀ…UèхGÀ…WхG
^
ü’À˜‘½dˆö”‚©‚ç p æˆö”‚ð‚Ƃ肾‚·
x
…GѲ݀ąU…W))
ˆ
…WèхG
š
“²Û…G)Ñð
À
$²Û…W)ÕðŽ¶À˜p æˆö”‚È‚µ
 .…GÑðÀ‰IÑðŠ²Û…W)èƒPÀ€ÿ…GI)рÿ…WIåƒP)ÀŒ
" 8…UåхGÀ˜1 æ‚¾‚¯–ß‚·
, B‡ñÊ
3 L·
C V…MFèхU
J `•
S j˜
t t˜ Get Irreducible Factors
™ ~˜ find factors of Deg% degree
¢ ˆ˜
¾ ’³õ IrredFactor(…F)
ö œºI…G…U…PowNeg…W…Z…Ansр½)…Tmp
 ¦²Û…F)сDegŽ•(€½…F))
& °…UхF
9 º…Tmpр½…F)
B Ä’
h Î…WѳõRndPolyRí(ñåDegÞñ)
· ؍ƒPÑñŽ…ZхWÀ‰IÑñŠDegÞñÀ…ZхZïñç…UÀ…WÝхZÀŒ
á âÀ…WѳõWPDí(…WDeg)݀ûñ)
ò ì…Uрûñ)

ö‰IÑñŠ€Â…Tmp)
"
…Fрþ…TmpI)
5
…FÑðŽñZ
O
…GѲ݀ąF…W))
w
€çðԲۅG)²ۅG)ԲۅF)}Ž
ˆ
( À…FèхG
À
2 À²Û…F)сDegŽ…AnsÝхFÀ…FÑð…UåхF—
Ù
< À€þ…TmpI)хF
F À²Û…G)сDegŽ…AnsÝхG…TmpÝхGÀ…UåхG—
*PÀ…UåхF
1ZŒ
Ed“…Uрûñ)
Sn•(…Ans)
\x˜
u‚³õRndPoly(Deg)
€Œº…W
ž–DegÑñ݀܀êå€êåDeg)
± ‰IÑðŠDeg
Ϊ€ÿ…WI)р܀êåƒP)
Õ´Œ
⾕(…W)
ëȘ
Ò˜ Sort result
ܘ
$æõ
SortResult(&…X)
CðºIJ…W…W1…W2
fú…WхXÀ…Xр½€þ…WÂñ))
‰IÑñŠ€Â…W)Þñ
£PtrсIÀ…W1рþ…WI)
¿‰JсIÝñŠ€Â…W)
Ö"…W2рþ…WJ)

,³õPolycmplí(…W1…W2)ÒðŽPtrсJÀ…W1хW2
6Œ
W@…XÝхW1ÀPtrցIŽ…W1рþ…WI)À€þ…WPtr)хW1
^JŒ
yT…XÝрþ…W€…W))
€^•
‰h˜
¦r³õPolyCmp(…W1…W2)
±|ºI
І²Û…W1)ҲۅW2)Ž•(ñ)
𐍲ۅW1)ԲۅW2)Ž•(Þñ)
š‰IѲۅW1)Šð‹Þñ
6¤€ÿ…W1I)Ҁÿ…W2I)Ž”‰À•(ñ)
c®€ÿ…W1I)Ԁÿ…W2I)Ž”‰À•(Þñ)
j¸Œ
t•(ð)
}̘
‘Ö˜ MAKE Z^P-Z
šà˜
«êõMakeZPZ
»ôºI…W
âþ²Û…U)҃PŽ…ZÑ_XïƒPÀ‡ñD
…WрûðÂñ)À…Zрûñ)
‰IÑðŠ€ÂƒP)Þñ
C€ÃIƒP)Ž…ZхZå…Wç…U
[&…WхWïñç…U
b0Œ
{:…ZхZå…Wç…U
˜D…WхZÀ†Zñ)хZ
ÔN‰IÑñŠ²Û…U)À…WхWå…Zç…UÀ†ZI)хWÀŒ
óX…ZÑ(…ZހûðÂñ))ç…U
úb•
l˜
2v˜ MAKE Z^(P^deg)-Z from Z^(P^(deg-1))-Z
;€˜
MŠõRaiseZPZ
]”ºI…W
už…WхZ݀ûðÂñ)
Œ¨…Zрû€ÿ…WÂð))
²‰IÑñŠ²Û…W)À…ZÝцZI)å€ÿ…WI)ÀŒ
á¼…ZÑ(…ZހûðÂñ))ç…U
èÆ•
ñИ
Ú˜ MAKE W#^((P^deg%-1)\2)
ä˜
4î³õWPD(…WDeg)
NøºIJ…V…X
|…Wѳõ PolyPowerðí(…WÂ(ƒPÞñ)èñ)
‹ …VхW
¤‰IÑñŠDegÞñ
» …Xрû€ÿ…VÂð))
ñ*‰JÑñŠ²Û…V)À…XÝцZJ)å€ÿ…VJ)ÀŒ
4…VхX
>…WхWå…Vç…U
HŒ
-R•(…W)


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