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 20001 would qualify.
I was thinking of using the…
As a simple example, there is a list of prime factors.
{{2, 1}, {3, 2}, {43, 5}, {26684839, 1}}
How to combine them to the number 70612139395722186 using Mathematica?
I read here that Baillie-PSW primality test is proven correct up to $2^{64}$, but I understand PrimeQ is only proven correct up to $10^{16}$, or was that extended up to $2^{64}$? Doesn't PrimeQ use a variation of Baillie-PSW? For many years I have…
Consider p such that PrimeQ[p] == True. How do I compute n such that Prime[n] == p?
In other words, what is the inverse function of "Prime"?
EDIT:
As a concrete example, consider p to be the first prime that factorizes rsa-768,
p = rsa768a =…
Update
Is there any better way of generating the nth prime power?
Chip Hurst gave a great solution for a list below, so
PrimePowersUpTo[x_] := Union @@ Table[Prime[Range[PrimePi[x^(1/n)]]]^n, {n, Log2[x]}]
pp=PrimePowersUpTo[10^7];
pp[[n]]
would…
For every prime number $p$, the function ${\rm ms_2}(p)$ gives the smallest prime number that results in a power of 2 when added to $p$.
For example: ${\rm ms_2}(857) = 167$, since $857+167 = 1024 = 2^{10}$.
What is wrong with this Mathematica…
I found out yesterday that there is a conjecture that the following function generates an addition chain:
$f(n)=\pi({n(n+1)\over 2}+1)$ for and integer $n\ge 1$. $\pi(x)$ is the prime counting function. So the addition chain part requires:
$f(x) …
Is there a faster implementation of Prime[] available somewhere, already implemented by someone? (Maybe as a compiled routine?)
The default function in Mathematica is slow for large values, and does not work for very large values (greater than…
I try to use the for loop to solve this question, but it does not work. And here is what I did.
For[p = 2,p<=10000,(p-1)! = -1 mod (p^2),Print[p]]
I am not sure how to describe "(p−1)!≡−1 mod p^2" in Mathematica. Could you give me some suggestions?…
Using the primality test on this site, I found that the concatenation of the digit reversal of the first 548 odd primes in the reverse order is a prime!. It is only a 1998-digit prime, but it took more than an hour for the site's calculator to state…
One can compute the amount of twin primes below a positive integer $n$ by using the Mathematica command (taken from OEIS A001097):
Length[Select[Prime[Range[n]], PrimeQ[# + 2] &]]
The twin prime conjecture states that this value should approach…
I create a list of primes in table form... How do I generate and display the difference between the prime numbers in sequence?
In[1]:= Table[Prime[n], {n, 10}]
Out[1]= {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
expected output:
{1, 2, 2, 4, 2, 4, 2, 4,…
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.
Sort[Times @@@ Subsets[Select[Range[2000], PrimeQ], {3}]]
How do I find the longest subsequence…
I would like to detect prime numbers within an interval $\mathcal{I}:[a,b]$. The only problem is that the interval contains very large numbers - in excess of 10000 digits each and $\# \mathcal{I}$ is also very large.
One of my tasks involves…
I'm looking for a code that finds the number of primes p less than or equal to X satisfying p is congruent to 1 (mod 4) and another code that finds the number of primes p less than or equal to X satisfying p is congruent to 3 (mod 4).