English
Source / code snippets

Bachet-erweiterter Euklidischer Algorithmus

 

p.specht


Window Title "Bachet-erweiterter Euklidischer Algorithmus"
Window Style 24
declare a&,b&, g&,x&,y&,s$
Main:
Font 2
CLS
print "\n The Algorithmus seek whom ggT(a,b) and begründet it.\n"
print " it counts: ggT(a,b) = a * X + b * Y   with a,b,X,Y ganzzahlig."
print
print "\n a = ";:input a&
print   " b = ";:input b&
g&=Bachet(a&,b&)
Font 2:Print "\n\n  ggT(a,b) = ";g&,"   = ",x&,
Font 0:print "*",a&,
Font 2:print "+",y&,
Font 0:print "*",b&,"\n"
waitinput
Goto "Main"

proc Bachet :parameters a&,b&

    declare bg&,bu&,cg&,cu&,xg&,xu&,yg&,yu&
    bg&=a&
    cg&=0
    xg&=1
    yg&=0
    bu&=b&
    cu&=a&\b&
    xu&=0
    yu&=1

    while (bg&<>0) and (bu&<>0)

        xg&=xg&-cu&*xu&
        yg&=yg&-cu&*yu&
        bg&=bg& mod bu&

        if bg&=0

            g&=bu&
            x&=xu&
            y&=yu&

        else

            cg&=bu&\bg&
            xu&=xu&-cg&*xg&
            yu&=yu&-cg&*yg&
            bu&=bu& mod bg&

        endif

        if bu&=0

            g&=bg&
            x&=xg&
            y&=yg&

        else

            cu&=bg&\bu&

        endif

    endwhile

    return g&

endProc

 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/30/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.341 Views

Untitledvor 0 min.
p.specht11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
Wilfried Friebe11/17/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie