Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
_modMul ← { n _𝕣: n|× }
|
||||
MillerRabin ← { 𝕊n: 10𝕊n ; iter 𝕊 n: !2|n
|
||||
# n = 1 + d×2⋆s
|
||||
s ← 0 {𝕨 2⊸|◶⟨+⟜1𝕊2⌊∘÷˜⊢,⊣⟩ 𝕩} n-1
|
||||
d ← (n-1) ÷ 2⋆s
|
||||
|
||||
# Arithmetic mod n
|
||||
Mul ← n _modMul
|
||||
Pow ← Mul{𝔽´𝔽˜⍟(/2|⌊∘÷⟜2⍟(↕1+·⌊2⋆⁼⊢)𝕩)𝕨}
|
||||
|
||||
# Miller-Rabin test
|
||||
MR ← {
|
||||
1 =𝕩 ? 𝕨≠s ;
|
||||
(n-1)=𝕩 ? 0 ;
|
||||
𝕨≤1 ? 1 ;
|
||||
(𝕨-1) 𝕊 Mul˜𝕩
|
||||
}
|
||||
C ← { 𝕊a: s MR a Pow d } # Is composite
|
||||
{0:1; C •rand.Range⌾(-⟜2) n ? 0; 𝕊𝕩-1} iter
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Compute n|𝕨×𝕩 in high precision
|
||||
_modMul ← { n _𝕣:
|
||||
# Split each argument into two 26-bit numbers, with the remaining
|
||||
# mantissa bit encoded in the sign of the lower-order part.
|
||||
q←1+2⋆27
|
||||
Split ← { h←(q×𝕩)(⊣--)𝕩 ⋄ ⟨𝕩-h,h⟩ }
|
||||
# The product, and an error relative to precise split multiplication.
|
||||
Mul ← × (⊣ ⋈ -⊸(+´)) ·⥊×⌜○Split
|
||||
((n×<⟜0)⊸+ -⟜n+⊢)´ n | Mul
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
MillerRabin 15485867
|
||||
1
|
||||
MillerRabin¨⊸/ 101+2×↕10
|
||||
⟨ 101 103 107 109 113 ⟩
|
||||
Loading…
Add table
Add a link
Reference in a new issue