English
Source / code snippets

joint maths Primzahl Verify Teiler

 

Jac
de
Lad
here time one Posting of me:

Verify whether a number number Primzahl is:
CompileMarkSeparation
Proc IsPrim

    Parameters z&
    declare x&,x%
    case LT(z&,11):Return If(Or(Or(Or(Equ(z&,2),Equ(z&,3)),Equ(z&,5)),Equ(z&,7)),1,0)
    x&=3

    whileloop 3,Int(Sqrt(z&)),2

        case Equ(Mul(&Loop,Div&(z&,&Loop)),z&):Inc x%
        case x%:Break

    wend

    Return Not(x%)

CompileMarkSeparation
proc GGT

    Parameters x&,y&
    declare z&,a&,b&

    if LT(x&,y&)

        z&=x&
        x&=y&
        y&=z&

    endif

    while GT(y&,0)

        b&=y&
        y&=Mod(x&,y&)
        x&=b&

    wend

    Return x&

endproc


Kleinstes common multiple (needed GGT, see supra):
CompileMarkSeparation
Def kgv(2) Div&(Mul(&(1),&(2)),GGT(&(1),&(2)))

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
12/03/05  
 




Carlo
Keil
Hello Jac,

I recommend, the KGV so To to charge, because otherwise one To grosser worth at product come into being and to a incorrect Result lead can:
CompileMarkSeparation
Proc KGV

    Parameters x&, y&
    Declare q&
    q& = @GGT(x&, y&)
    Return @Div&(x&, q&) * @Div&(y&, q&)

End
a>

Greeting
Carlo
 
12/05/05  
 



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

3.516 Views

Untitledvor 0 min.
p.specht10/17/18
Jörg Sellmeyer05/18/18
Paul Glatz04/10/13
Julian Schmidt10/20/12

Themeninformationen

this Topic has 2 subscriber:

Carlo Keil (1x)
Jac de Lad (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