Montgomery reduction: Difference between revisions

m
→‎{{header|Tcl}}: fix broken highlighting
(→‎Tcl: Added implementation (output to come once worked out how to demonstrate…))
m (→‎{{header|Tcl}}: fix broken highlighting)
Line 248:
<lang tcl>package require Tcl 8.5
 
proc montgomeryReduction {m m'mDash T n {b 2}} {
set A $T
for {set i 0} {$i < $n} {incr i} {
Line 255:
set a [expr {$a / $b}]
}
set ui [expr {($a % $b) * ${m'}mDash % $b}]
incr A [expr {$ui * $m * $b**$i}]
}
Anonymous user