mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > And now for something completely different

Reply
 
Thread Tools
Old 2022-06-20, 19:22   #166
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

4,201 Posts
Default

Quote:
Originally Posted by Luminescence View Post
Code:
fft size: 16384
avx: 8
round off 3: 0.000000
round off 2: 0.000000
prp

real	0m9,978s
Nice.

So in short: the latest code works, but the FFT size needs to be increased.
I have just put out (post 148) code that does autoincrement of FFT size on excessive round-off error. Attached is the concept test program.
Attached Files
File Type: c frmky2.c (3.3 KB, 12 views)
paulunderwood is offline   Reply With Quote
Old 2022-06-20, 20:19   #167
frmky
 
frmky's Avatar
 
Jul 2003
So Cal

5×479 Posts
Default

Code:
*** Maximum error of 0.500000 excessive at iteration 108154. Increasing FFT size.
prp

real    0m41.429s
Being a bit more conservative with a limit of 0.35 gives
Code:
*** Maximum error of 0.375000 excessive at iteration 108660. Increasing FFT size.
prp

real    0m41.536s
which switches a bit more than 500 iterations earlier.
frmky is online now   Reply With Quote
Old 2022-06-20, 23:45   #168
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

4,201 Posts
Default

Attached is a version that uses a quick gwswap() rather than a slow gwcopy(). I have added the corresponding Ver_5 code to post 148.
Attached Files
File Type: c frmky3.c (3.3 KB, 13 views)

Last fiddled with by paulunderwood on 2022-06-20 at 23:46
paulunderwood is offline   Reply With Quote
Old 2022-06-22, 19:19   #169
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

4,201 Posts
Default

The ultimate Ver_6 has been uploaded to post 148. It uses functions and a neat piece of code to calculate odd d for n-1=d*2^r thanks to frmky. It might be a little bit quicker. As I state there, comment out the printf(); function messaging about FFT increases if you find them annoying at runtime.

frmky is working on 3-SPRP GMP code to be used above a certain threshold based this UTM page. This is useful for ARM based computers.

Last fiddled with by paulunderwood on 2022-06-22 at 19:27
paulunderwood is offline   Reply With Quote
Old 2022-06-22, 19:42   #170
frmky
 
frmky's Avatar
 
Jul 2003
So Cal

5·479 Posts
Default

Quote:
Originally Posted by paulunderwood View Post
frmky is working on 3-SPRP GMP code to be used above a certain threshold based this UTM page. This is useful for ARM based computers.
Below is the code I settled on. I thank Paul for his suggestions and comments! I have tested it on many known primes and base-3 strong pseudoprimes.

This code is slower than Paul's version using gwnum but is faster than mpz_probab_prime_p(). It's useful where gwnum is not available.

Code:
int cm_nt_is_prime (mpz_t n)

{
   unsigned long j, r;
   int prime = 0;
   mpz_t d, a, x, n_sub_1;

   if (mpz_sizeinbase(n, 2) < 4096) return (mpz_probab_prime_p(n, 0) > 0);
   if (mpz_even_p(n)) return 0;

   mpz_inits(d, a, x, n_sub_1, NULL);

   mpz_sub_ui(n_sub_1, n, 1);
   r = mpz_scan1(n_sub_1, 0);
   mpz_fdiv_q_2exp(d, n_sub_1, r);

   mpz_set_ui(a, 3);
   mpz_powm(x, a, d, n);

   if ((mpz_cmp_ui(x, 1) == 0) || (mpz_cmp(x, n_sub_1) == 0)) prime = 1;
   else {
      for (j = 1; j < r; j++) {
         mpz_powm_ui(x, x, 2, n);
         if (mpz_cmp(x, n_sub_1) == 0) {
            prime = 1;
            break;
         }
      }
   }
    
   mpz_clears(d, a, x, n_sub_1, NULL);
   return prime;
}
frmky is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
For which types of primes is GPU primality test software available? bur GPU Computing 6 2020-08-28 06:20
Fastest software for Mersenne primality test? JonathanM Information & Answers 25 2020-06-16 02:47
APR-CL as primality proof f1pokerspeed FactorDB 14 2014-01-09 21:06
Proof of Primality Test for Fermat Numbers princeps Math 15 2012-04-02 21:49
PRIMALITY PROOF for Wagstaff numbers! AntonVrba Math 96 2009-02-25 10:37

All times are UTC. The time now is 05:47.


Sat Jun 25 05:47:31 UTC 2022 up 72 days, 3:48, 0 users, load averages: 0.74, 1.02, 1.10

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, 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.

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