![]() |
Nicht-Primzahl-Test nach Fermat
(Für mathematischen Hintergrund und Beweis, siehe
![]()
Delphi-Quellcode:
Wichtig: Wenn diese Funktion false zurückgibt, heißt das nicht, dass n eine Primzahl ist. Es ist lediglich eine
uses Math;
{a ist eine beliebige Zahl zwischen 1 und n-1; n ist zu testende Zahl} function IsNotPrime(const a, n: longint): boolean; begin Result := (Round(Power(a, n-1)) mod n) <> 1; end; ![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz