-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathFGIntPrimeGeneration.pas
59 lines (46 loc) · 1.72 KB
/
FGIntPrimeGeneration.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{License, info, etc
------------------
This implementation is made by me, Walied Othman, to contact me
mail to [email protected] or [email protected],
always mention wether it 's about the FGInt for Delphi or for
FreePascal, or wether it 's about the 6xs, preferably in the subject line.
If you 're going to use these implementations, at least mention my
name or something and notify me so I may even put a link on my page.
This implementation is freeware and according to the coderpunks'
manifesto it should remain so, so don 't use these implementations
in commercial software. Encryption, as a tool to ensure privacy
should be free and accessible for anyone. If you plan to use these
implementations in a commercial application, contact me before
doing so, that way you can license the software to use it in commercial
Software. If any algorithm is patented in your country, you should
acquire a license before using this software. Modified versions of this
software must contain an acknowledgement of the original author (=me).
This implementation is available at
http://triade.studentenweb.org
copyright 2000, Walied Othman
This header may not be removed.
}
Unit FGIntPrimeGeneration;
Interface
Uses SysUtils, FGInt;
Procedure PrimeSearch(Var GInt : TFGInt);
Implementation
{$H+}
// Does an incremental search for primes starting from GInt,
// when one is found, it is stored in GInt
Procedure PrimeSearch(Var GInt : TFGInt);
Var
two : TFGInt;
ok : Boolean;
Begin
If (GInt.Number[1] Mod 2) = 0 Then GInt.Number[1] := GInt.Number[1] + 1;
Base10StringToFGInt('2', two);
ok := false;
While Not ok Do
Begin
FGIntAddbis(GInt, two);
FGIntPrimeTest(GInt, 4, ok);
End;
FGIntDestroy(two);
End;
End.