Questions on testing and computing prime numbers.

learn more… | top users | synonyms

4
votes
2answers
58 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$, ...
3
votes
1answer
49 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 ...
2
votes
1answer
103 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 ...
8
votes
5answers
309 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 ...
1
vote
1answer
178 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 ...
48
votes
2answers
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: ...
14
votes
6answers
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 ...
1
vote
5answers
357 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. ...
4
votes
1answer
65 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 ...
1
vote
0answers
58 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 ...
7
votes
0answers
125 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}.$ ...
10
votes
1answer
201 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 ...
9
votes
1answer
176 views

Finding large prime gaps

I am using basic searches for prime gaps as follows: ...
39
votes
10answers
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 ...
3
votes
2answers
132 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\}\},$$$$ ...
0
votes
1answer
191 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 ...
1
vote
1answer
186 views

Something wrong with FromDigits?

NestList[RotateLeft, IntegerDigits[19], 1] FromDigits[%] (* WRONG *) ...
15
votes
4answers
2k 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). ...
3
votes
1answer
204 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 ...
5
votes
3answers
285 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.
3
votes
4answers
274 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, ...
0
votes
1answer
95 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 ...
3
votes
4answers
298 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 ...
14
votes
3answers
686 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. ...
2
votes
3answers
159 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 ...
13
votes
3answers
562 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. ...
20
votes
4answers
890 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 ...
1
vote
2answers
346 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 ...
1
vote
1answer
64 views
3
votes
4answers
282 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. ...
0
votes
2answers
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 ...
1
vote
2answers
100 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 ...
3
votes
2answers
215 views

Prime power list

Update Is there any better way of generating the nth prime power? Chip Hurst gave a great solution for a list below, so ...
0
votes
1answer
75 views

Consecutive integers that can be written as the product of three distinct primes

Mathematica novice here. I want to start with a list of integers that are the product of three distinct primes m,n, and o, where 2 <= m|n|o < 2000. ...
4
votes
2answers
343 views

Approximation to the prime counting function

Is there a function similar to PrimePi that gives approximate value for large numbers? In particular, I need a reasonably good approximation for $\pi(x)$, where ...
11
votes
4answers
554 views

Set of integers not divisible by smaller set of primes

Let $p_n$ be the sequence of prime numbers, and $s(x,n)=$ the set of integers less or equal than $x$ that are not divisible by $p_1,\dots,p_n.$ I can define it as follows: ...
0
votes
2answers
194 views

prime-palindromic number selected from a list

I want to find all prime-palindromic numbers up to 5000. Prime-palindromic numbers are numbers that themselves and their reverse digits are both primes. For example, 31 is a prime-palindromic number ...
2
votes
0answers
134 views

Displaying primes as a 3D array of spheres

I am currently learning my way through Mathematica and have stumbled upon a strange problem. It is asking me to implement PrimeQ into ...
5
votes
2answers
183 views

FactorInteger over UFDs

How can I factor 'integers' over other quadratic number fields (not just gaussian integers). For instance, how could I factor $7 = (3 + ω)(2 − ω)$ over Eisenstein integers ($ω = \frac{-1+ I ...
8
votes
4answers
353 views

Generate PrimePower counting function

Is there a way to generate a counting function for prime powers - i.e. to create a similar function to PrimePi, but including prime powers. The following will, of ...
0
votes
0answers
44 views

Limits of PrimeNu [duplicate]

Is there any way to find distinct prime factors for very large numbers using Prime and/or PrimePi that exceeds the ...
6
votes
2answers
351 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. ...
1
vote
0answers
38 views

Internals of Prime function [duplicate]

Does anyone knows how exactly Prime works ? For example how Prime[1000000000] is calculated ? The only information I found was ...
1
vote
1answer
292 views

How to represent very long integers with at-most-8-digit(base-10) short integers with * and +

I need an algorithm in Mathematica, which can represent any very long integer, prime or not, into the the product operation "*" and sum "+" forms by short integers (not more than 8 decimal digits). ...
2
votes
0answers
118 views

Double sum over primes [duplicate]

Can anyone tell me the value of the sum $$\sum_{p\in \mathcal{P}}\sum_{n=1}^{\infty}\frac{\log (p^n)}{2}\left[\,p^{-n}-\psi\left(\frac{p^n+2}{2}\right)+\psi\left(\frac{p^n+1}{2}\right)\right].$$ ...
12
votes
5answers
2k views

How can I simulate this animation of checking for prime numbers?

I can only implement a very simple one, I want to make my code look like that. Any better ideas? ...
12
votes
5answers
763 views

Double series over primes

I'm very curious if the following double series over primes has a closed form: $$\sum_{k \in \mathcal{P}}\sum_{n \in \mathcal{P}}\frac{1}{k\;n(k+n)^2}$$ where $\mathcal{P}$ denotes the set of all ...
13
votes
2answers
441 views

Is there a way to use functions like Prime[n] within Solve[]?

I'm trying to see if a number can be written as the sum of two prime numbers. Ideally, I would like to use Solve[ Prime[n] + Prime[m] == 100, {n, m}] But that ...
4
votes
1answer
487 views

How does Mathematica calculate the nth prime?

When I enter Prime[2000000000000], the two-trillionth prime, Mathematica gives 61427839512211 for the answer after several ...