Hi,

I want to thank you for your fast and detailed help. I worked with the
text you mentioned in your post and you are right, that the
computation of the irregular pairs should take the most time of the
algorithm. In my algorithm I´m doing both first the irregular pairs,
with the command bernoulli_mod_p and then verifiying Vandiver´s
conjecture. At the end of my post you cann see my algorithm, i have
tried the tip for the modular arithmetic. The results for Ergebnis are
the same, so it seemed to be correct. The algotithm is now faster, but
perhaps I can fasten up more with your help, so I would be very glad
for further tips.

For the problem with the cputime() command I will try the tip you
posted and report back my results.

Now my algorithm:
p=5009 #Gewuenschte Primzahl bitte hier eingeben
Zeit=cputime()
print 'Die gewaehlte Primzahl ist:'; print p
if is_prime(p):
 bernoullilist=bernoulli_mod_p(p)
 for i in range(p^2): #Berechnung der Primzahl q
   q=p*i+1
   if is_prime(q):
    break
 R=Integers(q)
 z=2^((q-1)/p)
 m=0 #erste irregulaere Stelle finden
 for i in range((p-1)/2):
  if bernoullilist[i]==0:
   t=2*i
   m=m+1
   print 'Die gewaehlte Primzahl teilt den Zaehler folgender
Bernoullizahl:'
   print t
   low=[1 for n in range(4096)]
   high=[1 for n in range(4096)]
   for i in range(1,((p-1)/2)+1):
    e=i^(p-1-t)%p
    u=(R(z)^i-R(z)^(-i))%q
    e0=e%4096
    e1=(e-e0)/4096
    low[e0]=R(low[e0])*u
    high[e1]=R(high[e1])*u
   product=1; terms=1; product2=1; terms2=1
   for i in range(4095,0,-1):
    terms=R(terms)*low[i]
    product=R(product)*terms
    terms2=R(terms2)*(high[i]^4096)
    product2=R(product2)*terms2
   end=product*product2
   end=end%q
   end2=end^((q-1)/p)
   Ergebnis=end2%q
   Zaehler=0
   if Ergebnis==1: #Ausgabe wie der Test verlaufen ist muss noch
ueberarbeitet werden
    print 'Der Test ist fehlgeschlagen'
    Zaehler=Zaehler+1
   else:
    print 'Der Test war erfolgreich'
 if m==0: print 'p ist eine regulaere Primzahl'
 if Zaehler==0: print 'Fuer die gewaehlte Primzahl gilt die Kummer-
Vandiver-Vermutung'
else: print 'Die eingebene Zahl ist keine Primzahl'
a=cputime(Zeit)
print 'Dieser Vorgang hat'
print a
print 'Sekunden gedauert.'

I thank you for your help.

Daniel Köhl



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to