Skip to main content

Questions tagged [primes]

Primes or prime numbers are numbers which are divisible only by themselves and one, starting with 2, 3, 5, 7, 11.... They are commonly used in encryption and hashing algorithms.

9 votes
4 answers
809 views

The purpose of this code is to find the smallest semiprime \$s = a b\$ satisfying a bunch of conditions stated in the Math.SE question What is the smallest "prime" semiprime?. The conditions ...
mezzoctane's user avatar
3 votes
1 answer
178 views

This example finds all "letter" structures. letter a = LMLMMM letter b = LMMMMM letter c = MMLMMM letter d = MMMMMM Symbol L = live = prime candidate number Symbol M = multiple = composite ...
dragoness's user avatar
  • 317
5 votes
1 answer
472 views

It implements prime number envelopes (page 3) from my paper: https://zenodo.org/records/16829092 The full working example is on github: https://github.com/cerebrummi/primeenvelopes "StartFA"...
dragoness's user avatar
  • 317
10 votes
2 answers
1k views

The fully working example finds all primes (theoretically). In real life the FA is constrained by stack size. The theoretical run is important, because it proves that all primes have a deterministic ...
dragoness's user avatar
  • 317
7 votes
5 answers
2k views

Is this an optimal solution? I doubt it is. Can someone please critique my code? ...
FirstTimer's user avatar
11 votes
3 answers
2k views

This is my C++ implementation of Computing π(x): the combinatorial method by Tomás Oliveira e Silva. The math involved is elementary number theory, but fiddly and not the focus here. I have ...
qwr's user avatar
  • 1,233
3 votes
1 answer
115 views

I wrote code for the multiple polynomial quadratic sieve (MPQS) here: ...
J. Doe's user avatar
  • 186
4 votes
2 answers
240 views

I've implemented this version of the Sieve of Eratosthenes in Rust, with inputs. I'm mostly pleased with it, but want to know if the input logic can be simplified, and if the sieve itself can be ...
Vessel's user avatar
  • 345
2 votes
1 answer
186 views

As Java programmers, we can always use the BigInteger isProbablePrime() method or store manually all prime numbers in a HashMap. This question is about the most efficient way to figure out if a single ...
user3595831's user avatar
6 votes
3 answers
926 views

Problem (Rephrased from here): The radical of \$n\$, \$rad(n)\$, is the product of distinct prime factors of \$n\$. For example, \$504 = 2^3 × 3^2 × 7\$, so \$rad(504) = 2 × 3 × 7 = 42\$. We shall ...
Nadav Nevo's user avatar
6 votes
0 answers
125 views

I'm trying to reproduce a paper on Prime Factorization. This paper converts the problem into a QUBO form, which then we can map it to an Ising Minimizer. I've basically done everything and I've ...
Amirhossein Rezaei's user avatar
2 votes
1 answer
195 views

The challenge Given array a of n numbers, I need to count how many positive numbers less than each aᵢ have exactly 3 divisors. Constraints 1 <= aᵢ <= 2.5 * 10¹³ In other words, the minimum ...
Muhammad Usman's user avatar
8 votes
4 answers
529 views

I recently encountered the Four Divisors problem on LeetCode and managed to achieve a 100% beat rate with my solution. I'd like to share it with you all and gather feedback on its effectiveness and ...
BrunoBarreto's user avatar
3 votes
1 answer
178 views

I implemented the Miller-Rabin-Primetest in python3. But I have the feeling it is very slow. I know that there are faster version in gmpy2 package, but I want to compare it with another code I have in ...
Lereu's user avatar
  • 141
1 vote
2 answers
158 views

I have an implementation of the Miller-Rabin prime test, coded in Python 3. I want to use that as a comparison to a prime test which I coded myself. Unfortunately I have no idea how "fast" ...
Lereu's user avatar
  • 141

15 30 50 per page
1
2 3 4 5
49