mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2022-03-18, 05:16   #1
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

452410 Posts
Default GMP PRP programs

This is the first in a series of three GMP based PRP programs; It does A times Fermat PRP tests followed by B times Lucas PRP tests. The second program will do the same but with "Jacobi strength" ; The third will do strong tests.

Note parts of the codes can be replaced with mpz_powm(res, base, something, align);
Attached Files
File Type: c gmp_fermat_lucas.c (4.0 KB, 116 views)
File Type: c gmp_euler_lucas.c (4.3 KB, 113 views)
File Type: c gmp_miller-rabin_lucas.c (5.0 KB, 119 views)

Last fiddled with by paulunderwood on 2022-03-18 at 16:05
paulunderwood is offline   Reply With Quote
Old 2022-04-29, 14:18   #2
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

106548 Posts
Default

Here is a program that does Miller-Rabin (Fermat) and the same sort of thing in Lucas terms.
Attached Files
File Type: c gmp_miller-rabin_strong-lucas.c (6.1 KB, 83 views)

Last fiddled with by paulunderwood on 2022-04-29 at 14:52 Reason: fixed usage words
paulunderwood is offline   Reply With Quote
Old 2023-02-24, 07:09   #3
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

22·3·13·29 Posts
Default

Here attached is a GMP program that does a base 2 Fermat PRP test followed by a Lucas binary chain PRP test over x^2-2^r*x+1 where jacob(4^r-4,n) is -1. It has a section to deal with Fermat numbers, and products of these.

Both Fermat and Lucas parts can be made strong. It does no trial division.

It is nearly as fast as GMP's mpz_probab_prime_p function. The speed comes form using 2^r in the chain and I believe a hand-crafted "mpn" program should be even quicker and as such would be quicker than mpz_probab_prime_p.

(It is similar to Pari/GP's ispseudoprime function, but uses 2^r instead of minimal "a"; The latter has to propogate more than the former when subtraction is done in the chain.)
Attached Files
File Type: c gmp_optimised_lucas_ver2.c (3.4 KB, 2 views)

Last fiddled with by paulunderwood on 2023-02-24 at 07:21
paulunderwood is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run these C++ programs? sweety439 sweety439 4 2020-06-08 16:16
tones from c programs davar55 Programming 12 2015-12-13 03:41
they used to be called programs... chappy Lounge 15 2012-08-11 21:02
GPU Testing programs nucleon GPU Computing 5 2011-08-21 04:24
factoring programs henryzz Factoring 6 2007-09-19 13:47

All times are UTC. The time now is 10:20.


Fri Feb 24 10:20:13 UTC 2023 up 190 days, 7:48, 0 users, load averages: 0.92, 0.95, 0.85

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔