# Tagged Questions

Questions on testing and computing prime numbers.

150 views

### Miller-Rabin algorithm [closed]

I want to implement the Miller-Rabin algorithm in Mathematica to check if a number is prime with at least 99.99% probability. I used this: ...
173 views

### OEIS A144311 Generating function

I'm looking for a way to use calculate OEIS A144311 efficiently in Mathematica. First, let's define the series. In one sense or another, this series considers the number between "relative" twin ...
127 views

### Accuracy of PrimeQ function

Using PrimeQ in Mathematica 10 on integers up to $2\cdot 10^{5717}$ the function appears to work. The Documentation for Mathematica 5 says that ...
65 views

### Twin Prime Max Gaps (Performance Tuning)

Ok, let's build a foundation here: A common way of testing primality, is dividing by all primes smaller than the number's square root. For instance, $97$ is prime because dividing by none of the ...
46 views

### Generate list of first 100 prime number? [closed]

I know how to generate a list of prime numbers up to a limit, but how would I generate the first 100 prime numbers in a list?
172 views

### Brute force evidence of possible proof of twin prime conjecture

Trying to avoid shelling out hundreds of dollars so I'm using what I can for free online. This is what I've come up with so far: https://dl.dropboxusercontent.com/u/76769933/TwinPrimes%203Podd.cdf ...
20 views

### What is the form of a PrimalityProvingPrimeQCertificate?

I understand the format of a proof of compositeness of an integer produced by PrimeQCertificate: it's well-documented that ...
93 views

### Plot prime numbers in spiral form, in the clockwise direction

I want to plot first 100 Prime numbers in circular format (on circular orbit) in Mathematica. How can i do this?
61 views

### The inverse function of “Prime” [duplicate]

Consider p such that PrimeQ[p] == True. How do I compute n such that Prime[n] == p? In other words, what is the inverse ...
229 views

### Primes Race (Mathematica Efficiency)

I am currently working with a paper that deals with this concept of Prime Races. You essentially create a large list of prime numbers and then split that list into two teams. You are assigned to ...
102 views

Building on this question, what is the most efficient counting function for distinct prime factors? It would obviously be more efficient if Prime and ...
370 views

### Memory management and speed for Fast GCD

Let's say that we have some $300\,\text{K}$ digits (arbitrary function) and want to trial factor with $100{,}000{,}000$ first prime numbers. ...
61 views

### Riemann Zeta function definition was expanded by Euler with an infinite product series [duplicate]

The Euler infinite product series definition for Riemann's zeta function requires that Mathematica use all prime numbers in the product series. Can anyone help me with the code that will give a ...
116 views

### Memory limit hit: optimize code for finding twin primes

I need some help optimizing a Mathematica code so that it'll not max out RAM. Here's the code: Cell 1 ...
53 views

### Timing and ListPlot

I am currently trying to examine the Timing function as it relates to generating primes and factorize large integers. What I want to do is to visualize how time ...
95 views

### Goldbach Partition

I want to check the Goldbach conjecture for big number of $n$, but I don't know how to define this in Mathematica. There are my questions: Find a pair of primes $(p,q)$ for every even integer $n$, ...
50 views

### A function about prime gaps

I want to define a $f$ function on Mathematica such as this. $f[k]$ gives the smallest $m$ holds $2k=Prime[m+1]-Prime[m]$. For example, $$f[1]=2$$ $$f[2]=4$$ $$f[3]=9$$ $$f[4]=24$$ How can i do that?...
105 views

### One of the factors greater than $x$

Is there an easy way to tell Mathematica to find one of the prime factors of $n$ greater than $x$. For example, if $n=1299709\cdot 7919 \cdot 17$, is there a way to request a factor greater than $100$....
337 views

### Finding large primes

I'm quite new to Mathematica and I am trying to find large prime numbers that can be written using only the digits 0, 1, 2 and 3 and more than half of these digits have to be 0. For example 1000 and ...
202 views

### Why can't mathematica tell me the smallest prime number?

I entered MinValue[{Prime[n], n>=1 && Element[n, Integers]}, n] But I just got back what I entered. Why can mathematica not tell me the smallest ...
4k views

### What is so special about Prime?

When we try to evaluate Prime on big numbers (e.g. 10^13) we encounter the following issue: ...
1k views

### Generating an Ulam spiral

An Ulam Spiral is quite an interesting construction, revealing unexpected features in the distribution of primes. Here is a related topic with one answer by Pinguin Dirk, who has provided one ...
365 views

### Prime factorization

I am trying to find a code that will output the prime factor decomposition of a number but for some reason I keep getting error messages. It is supposed to output the exponent of 2 and the odd factor. ...
67 views

### Create a function for $\Pi^{-1}(n)$

Is it possible to create a function that gives the inverse of pP[x_] := Sum[PrimePi[x^(1/k)]/k, {k, 1, Floor[Log2[x]]}] i.e., a function that plots ...
59 views

### Why can't I use OmegaPrime to find the Limit of Prime[n]? [duplicate]

I've looked at these links already; What are the limits of the Prime-functions? What is so special about Prime? which gave an answer for earlier versions of Mathematica. Yet when I try to input ...
128 views

### Is this a reliable method for getting a list of very large primes?

As noted here, both PrimePi and Prime are documented as having their limits somwhere around $10^{15}.$ ...
215 views

### Is there a PrimeQ whose accuracy guarantee you can adjust?

Say I have a list of a million integers each with a million digits, and I want a crude sieve to see which have a chance at being prime. Mathematica has a PrimeQ function, which appears to be slow ...
178 views

### Finding large prime gaps

I am using basic searches for prime gaps as follows: ...
2k views

### Happy 2K prime question

This being the Q number 2K in the site, and this being the day we got the confirmation of mathematica.se graduating soon, I think a celebration question is in order. So... What is the fastest way to ...
136 views

### Symbolic multiplicative partitions

Let $p_n\#\equiv\prod_{k=1}^{n}p_k$ (primorial): p[n_] := Times @@ Prime[Range[n]] then the multiplicative partitions of $p_{1,2,3,4}\#$ are $$\{\{2\}\},$$ \{...
212 views

### Prime number The Ulam spiral [closed]

I want a simple method of visualizing the prime numbers that reveals the apparent tendency of certain quadratic polynomials to generate unusually large numbers of primes. I was able to display the ...
190 views

### Something wrong with FromDigits?

NestList[RotateLeft, IntegerDigits[19], 1] FromDigits[%] (* WRONG *) ...
3k views

### Semi prime numbers

The high school textbook I am using has the example of semi-prime numbers. They wanted students to find (by "perspiration") all the semi-prime numbers less than $50$ (for a question on set theory). ...
212 views

### Faster Solve for Fermat 4n+1 conjecture

Assuming that Fermat 4n+1 conjecture (each prime of the form 4n+1 is the sum of two squares) is true then I like to solve the ...
297 views

### How could I implement the equivalent of NextPrime

I would like to know what an implementation of the function NextPrime would look like if it were implemented in Mathematica's core language.
354 views

### Permuted Prime Numbers

How can I produce all 3-digit and 4-digit prime numbers [100-9999] in which, all permutations of all digits produce again a prime number, such as 311, 131, 113, ...
97 views

### A question about calculus and Programming

I am a very new user and I would like to know how to calculate the following operations in Mathematica. Honestly this is not a homework. I am an french architect and I would like to be back in Math ...
317 views

### how to combine a list of the prime factors

For example, there is a list of prime factors. {{2, 1}, {3, 2}, {43, 5}, {26684839, 1}} How to combine them to the number ...
740 views

### How can FactorInteger be so slow if PrimeQ is fast?

My 8th grade son had a homework problem to find a prime factor of $99!-1$. I thought to be clever/lazy and used FactorInteger[99!-1], but it takes forever. ...
164 views

### Finding primes that have certain property

Let S[p] denote the sum of digits of p. A prime p is said to be stubborn if none of ...
595 views

### Next highly composite number?

R language has this function 'nextn' (link) which computes the next highly composite number greater than a given one, which is used to find the optimal padding size for the subsequent FFT operation. ...
909 views

### Why does Mathematica claim there is no even prime?

I wonder if this is a bug, or if I'm misunderstanding something: Exists[n, EvenQ[n] && PrimeQ[n]] // Resolve (* ==> False *) So if I interpret this ...
389 views

### How to generate a random, relatively prime number to p?

I'm sorry if this is an obvious question, but I'm a newbie and googling didn't help me much. Is there a way in Mathematica to generate a number q coprime with <...
67 views

### How to import a file for processing but not for displaying? [closed]

Here's my problem, I want to take what I have now for code ...
295 views

### How to search for patterns to find the positions of prime numbers

I have a summation which yields a prime number at each location there is a 2, and I do not know how to search for the 2's. ...
183 views

### How do I find my maximum precision on my computer? [duplicate]

I'm trying to run this ...
89 views

### Is there a manual way to generate a string of zeroes with a 2 at the end?

How do I get mathematica to display 33141015 zeroes and a 2 I've tried using 2*10^-33141016 but it just gives me scientific notation Is there a manual way to generate a string that looks like ...
110 views

### Infinite sums with Boole and EvenQ

Suppose I am interested in a sum across a set of even numbers, such as: Sum[x, {x, 2, 20, 2}] 110 or ...