Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/anupq/src/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 28.7.2025 mit Größe 820 B image not shown  

SSL invert_modp.c   Sprache: C

 
/****************************************************************************
**
*A  invert_modp.c               ANUPQ source                   Eamonn O'Brien
**
*Y  Copyright 1995-2001,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany
*Y  Copyright 1995-2001,  School of Mathematical Sciences, ANU,     Australia
**
*/


/* compute the multiplicative inverse of x modulo p
   using the forward extended euclidean algorithm */


int invert_modp(int x, int p)
{
   register int q;
   register int a1 = p;
   register int a2 = x;
   register int a3;
   register int y1 = 0;
   register int y2 = 1;
   register int y3;

   while (a2 != 1) {
      q = a1 / a2;
      a3 = a1 - a2 * q;
      y3 = y1 - y2 * q;
      a1 = a2;
      a2 = a3;
      y1 = y2;
      y2 = y3;
   }

   if (y2 < 0)
      y2 += p;

   return y2;
}

90%


¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.