Template:Euclidean algorithm steps/line: Difference between revisions

Content deleted Content added
No edit summary
try to fix for dark mode
 
(15 intermediate revisions by 2 users not shown)
Line 1:
<includeonly><!-- Note: The calculator r_x are two ahead of the text r_x -->
-->{{Calculator-hideifzero
{{Calculator-hideifzero|formula=ifgreaterorequal(curstep,{{#expr:{{{n}}}*2}},1,0)|starthidden=1|1={{#ifeq:{{{n}}}|0||<hr>}}{{calculator|formula=r{{{n}}}|type=plain|style=background-color: hsl(calc(var(--calculator-colorstep{{#expr:{{{n}}}*2-2}}) * 0.39215 + 55),100%,70%,calc(var(--calculator-colorstep{{#expr:{{{n}}}*2-2}}) + var(--calculator-colorstep{{#expr:{{{n}}}*2}})))}} = q<sub>{{{n}}}</sub> × {{calculator|formula=r{{#expr:{{{n}}}+1}}|type=plain|style=background-color: hsl(55,100%,70%,var(--calculator-colorstep{{#expr:{{{n}}}*2+2}}))}} + r<sub>{{{n}}}</sub><br>}}
|formula=ifgreaterorequal(curstep,{{#expr:{{{n}}}*2}},1,0)
{{Calculator-hideifzero|formula=ifgreaterorequal(curstep,{{#expr:{{{n}}}*2+1}},1,0)|starthidden=1|1=q<sub>{{{n}}}</sub> = {{calculator|formula=floor(r{{{n}}}/r{{#expr:{{{n}}}+1}})|id=q{{#expr:{{{n}}}+2}}|type=plain}} ; r<sub>{{{n}}}</sub> = {{calculator|formula=r{{{n}}}%r{{#expr:{{{n}}}+1}}|id=r{{#expr:{{{n}}}+2}}|type=plain|style=background-color: hsl(155,100%,70%,var(--calculator-colorstep{{#expr:{{{n}}}*2+2}}))}}{{calculator-hideifzero|formula=not(r{{#expr:{{{n}}}+2}})|starthidden=1|1=<br>Since r<sub>{{{n}}}</sub>=0 the algorithm is finished. Thus '''GCD( {{calculator|formula=x|type=plain}}, {{calculator|formula=y|type=plain}} ) = {{calculator|formula=ifequal(r{{#expr:{{{n}}}+1}},0,r0,r{{#expr:{{{n}}}+1}})|type=plain}}'''.}}}}{{calculator|type=hidden|id=colorstep{{#expr:{{{n}}}*2}}|formula=ifequal(curstep,{{{n}}}*2,255,0)}}
|starthidden=1
{{calculator|type=hidden|id=colorstep{{#expr:{{{n}}}*2+1}}|formula=ifequal(curstep,{{{n}}}*2+1,255,0)}}
|aria-live=polite
</includeonly>
|aria-atomic=true
|class=texhtml
|1={{#ifeq:{{{n}}}|0||<hr>}}{{calculator
|aria-live=off
|formula=r{{{n}}}
|type=plain
|style=background-color: light-dark( hsl(55,100%,70%,var(--calculator-colorstep{{#expr:{{{n}}}*2}})), hsl(55,100%,25%,var(--calculator-colorstep{{#expr:{{{n}}}*2}})) ); color: inherit
}} = q<sub>{{{n}}}</sub> × {{calculator
|aria-live=off
|formula=r{{#expr:{{{n}}}+1}}
|type=plain|
{{Calculator-hideifzero|formula=ifgreaterorequal(curstep,{{#expr:{{{n}}}*2}},1,0)|starthidden=1|1={{#ifeq:{{{n}}}|0||<hr>}}{{calculator|formula=r{{{n}}}|type=plain| style=background-color: light-dark( hsl( calc( var( --calculator-colorstep{{#expr:{{{n}}}*2-2}},0) * 0.39215 + 55), 100%, 70%, calc( var( --calculator-colorstep{{#expr:{{{n}}}*2-2}},0) + var(--calculator-colorstep{{#expr:{{{n}}}*2+2}})))}}, =hsl( q<sub>{{{n}}}</sub>calc( ×var( {{--calculator|formula=r-colorstep{{#expr:{{{n}}}+1*2}}|type=plain|style=background-color:,0) * 0.39215 + hsl(55), 100%,70 25%, calc( var( --calculator-colorstep{{#expr:{{{n}}}*2+2}},0))}} + r<sub>var(--calculator-colorstep{{#expr:{{{n}}}</sub><br>*2+2}}))) ); color: inherit
}} + r<sub>{{{n}}}</sub><br>
}}<!--
-->{{Calculator-hideifzero
|aria-atomic=true
|aria-live=polite
|formula=ifgreaterorequal(curstep,{{#expr:{{{n}}}*2+1}},1,0)
|starthidden=1
|class=texhtml
|1=q<sub>{{{n}}}</sub> = {{calculator
|formula=floor(r{{{n}}}/r{{#expr:{{{n}}}+1}})
|aria-live=off
|id=q{{#expr:{{{n}}}+2}}|type=plain
}}; r<sub>{{{n}}}</sub> = {{calculator
|formula=r{{{n}}}%r{{#expr:{{{n}}}+1}}
|id=r{{#expr:{{{n}}}+2}}
|type=plain
|aria-live=off
|style=background-color: light-dark( hsl(155,100%,70%,var(--calculator-colorstep{{#expr:{{{n}}}*2+2}})), hsl(155,100%,25%,var(--calculator-colorstep{{#expr:{{{n}}}*2+2}})) ) ; color: inherit
}}
}}{{calculator-hideifzero
|formula=and(not(r{{#expr:{{{n}}}+2}}),ifgreaterorequal(curstep,{{#expr:{{{n}}}*2+1}},1,0))
|starthidden=1
|1=<br>Since {{math|1=r<sub>{{{n}}}</sub> = 0}} the algorithm is finished. Thus '''{{math|1=GCD( {{calculator|formula=x|aria-live=off|type=plain}}, {{calculator|formula=y|type=plain}} ) = {{calculator|aria-live=off|formula=ifequal(r{{#expr:{{{n}}}+1}},0,r0,r{{#expr:{{{n}}}+1}})|type=plain}}}}'''.
}}{{calculator
|type=hidden
|id=colorstep{{#expr:{{{n}}}*2}}
|formula=ifequal(curstep,{{{n}}}*2,255,0)
}}{{calculator
|type=hidden
|id=colorstep{{#expr:{{{n}}}*2+1}}
{{calculator|type=hidden|id=colorstep{{#expr:{{{n}}}*2+1}} |formula=ifequal(curstep,{{{n}}}*2+1,255,0)}}
}}</includeonly>