cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013129 20 févr. 2006 à 12:59
Hum, elle est pourtant très ressemblante à du vb !
Ca doit donner un truc dans ce genre :
<ol><li>private
function
legendre(byval n as long,
byval
p as integer) As Integer
</li><li>Dim a as integer</li><li>dim m as integer</li><li>dim t as integer</li><li>dim k as integer</li><li>dim zyva as boolean</li><li>dim swap as integer</li><li>dim x as integer
</li><li></li><li>a n </li><li>m p </li><li>t = 1 </li><li> </li><li>
while
(a <> 0) </li><li> k m mod 8 </li><li> zyva iif(k = 3 or k = 5, true, false) </li><li> </li><li>
while
(a mod 2 0) </li><li> a a / 2 ; </li><li>
if
(zyva) then t = -t </li><li> wend </li><li> swap = a</li><li> a = m</li><li> m swap </li><li> x a mod 4</li><li> y = m mod 4 </li><li>
if
(x = 3 and x = y) then t = -t ; </li><li> a = a mod m </li><li> Wend </li><li>
if
(m = 1) then </li><li> legendre = t </li><li>
else
</li><li> legendre = 0 </li><li> end if</li><li>end function
</li></ol>
_