Questions tagged [prime-numbers]

Questions on testing and computing prime numbers.

Filter by
Sorted by
Tagged with
0
votes
0answers
80 views

How do I visualization generalized Pythagorean theory? [migrated]

maybe the Pythagorean equation is not alone. can't this equation be just one element of an array like this for example. exponents must be prime numbers (otherwise it's just a combination of other ...
5
votes
8answers
1k views

Making the number 12345...n

Well, I am trying to write a code that makes the number: $$123456\dots n\tag1$$ So, when $n=10$ we get: $$12345678910$$ And when $n=15$ we get: $$123456789101112131415$$ And when $n=4$ we get: $$1234$$...
0
votes
0answers
34 views

How to optimize Code for Wolfram Challenges?

I am wondering if anyone who has knowledge of optimizing programs in the Wolfram language has any advice on how to optimize the following quantities of programs written to solve Wolfram Challenges. I ...
0
votes
1answer
144 views

How to use every number between 2^50 and 2^100 without having to rewrite the code? [closed]

What I have currently written returns a numerical value and stores it in b100. p and q are random integers of size 2^50. I want to use the same code to calculate values where p and q ranges from 2^50 -...
0
votes
0answers
55 views

Inverse/Division in finite field?

Think of multiplictavie group of finite field F[p,n], where p is a prime number and n is a positive integer. The whole elements of F[p,n] can be represented as p^n-p^(n-1) positive integers in the ...
4
votes
1answer
274 views

Largest k such that p^k divides n

(Here all variables are integer.) Is there a built-in function f[n,p] such that f[n,p] = largest k such that p^k divides n For ...
2
votes
0answers
111 views

Approximate integer factorization

Suppose we would like to compute an approximate prime factorization of a large integer x in the sense that the difference between ...
4
votes
1answer
198 views

How to make a graphic for Sieve of Eratosthenes with a legend

Definition The Sieve of Eratosthenes is a simple algorithm to find the primes before a given $n$. Starting from $n=2$ you delete all multiples of 2, and keep incrementing till all that are left are ...
2
votes
0answers
59 views

Faster Prime[n] for large n, and for n larger than 10^12

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 ...
2
votes
1answer
189 views

How to return two values from function

I have a function that generates cipher text for ElGamal encryption and I want to make return two values, but it returns only one. This is the code: ...
0
votes
1answer
78 views

How to prime factorise rational numbers [closed]

I'm aware of the built-in FactorInteger command for finding the prime factorisation of integers. Is there a convenient way of determining the same thing for a rational number, where the prime ...
0
votes
1answer
117 views

Factorizing large numbers [closed]

I am trying to factorize large prime numbers with the code bellow. The code works properly for values like 1927 and 69527 (results), but gives no result for larger values like 655051. The code goes as ...
5
votes
1answer
67 views

PrimeQ versus Baillie-PSW primality test [closed]

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 ...
1
vote
1answer
40 views

Chinese remainder theorem large modulo [closed]

I have the following modulo congruences: x ≡ 0 (mod 2) x ≡ 2 (mod 5) x ≡ 21 (mod 41) x ≡ 16793129237622992703097532489897447320171386 (mod 648250901^5) I know, ...
0
votes
0answers
48 views

PowerMod solve for b (exponent)

Using PowerMod[a, b, m] = x I get ...
0
votes
1answer
79 views

One 1 minute (mathematica)

I wanna evaluate how large prime numbers my computer work at most 60 seconds. Of course, I can evalutate this manaully e.g. by trying different values. However, can I do this differently, e.g. by ...
5
votes
3answers
250 views

Speeding up FactorInteger for product of two primes

I have a large integer $N$ of size about 10^150. I know that $N$ is a product of two primes $p$ and $q$. I also know that both $p$ and $q$ are of roughly equal size, so one of them is not, for example,...
1
vote
2answers
137 views

Plotting Riemann Prime Counting

I want to program the formula in this page. Didn't take me long to get to my code below. But 1) it only plots the prime counting function and 2) evaluation takes incredibly long. How can I fix it? <...
1
vote
0answers
39 views

Geting all prime numbers from the fibonacci sequence in a range of <1000 [closed]

So my attempt was: PrimePi[Fibonacci[Range[1, 999]]] But that doesnt compile into anything. no result no error. i hope one of you got an idea.
0
votes
0answers
117 views

Goldbach's Conjecture?

If we have a list of even integers, how can we find partitions of size 2, then determine if the partitions are composed of prime numbers? So far, I think I would have to use ...
1
vote
1answer
70 views

Find the first 20 primes found by the classical proof of the infinitude of the set of primes

Begin with P={2}; then form,m, the sum of 1 with the product overall elements of P. Place the smallest prime factor of m into P and repeat. Suppose p = {p1,p2,...,pr}, then m = 1+ p1p2p3...pr. Example:...
2
votes
2answers
230 views

A Wilson prime is a prime p such that (p−1)!≡−1 mod p^2. Write a procedure which determines all Wilson primes less than10^4

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 ...
2
votes
1answer
82 views

How to write this simple task of unimodular prime search in mathematica?

For testing a particular algorithm I found mathematica is the best way as it has all the tools I need. I am stuck in a number theory part and since I am not an expert in mathematica I do not know how ...
0
votes
0answers
40 views

Incrementing Numbers

I want to take a prime number p0 = 3, add 2 to it to get a new number p1 = 5, then add four to p1 to get p2, then add 6 to p2 to get p3, etc for a total of 50 times. How do I do that and place my ...
1
vote
0answers
58 views

finding primes using chebyshev bias

Using the problem from my previous question link. For each n, that is n= $10^3$ to $10^6$ with a ten-fold increase, how do I use Chebyshev Bias to display the number of primes (which are in the ...
0
votes
1answer
51 views

How do I find how many numbers are prime(taking absolute value of negatives) in a list? When i use count it returns zero

f = 9x^2 - 78x-10000 list1 = PrimeQ[Abs[f /. x -> {Range[1, 20]}]] Count[list1,True] This is my code. Im trying to find how many prime numbers ...
2
votes
1answer
85 views

Trying to create a list that counts the number primes for each remainder class

Considier the remainder of the first $2500$ prime numbers by the numbers from $3$ to $30$, included. Calculate how many primes are in each remainder class. That is, create a list that for each number ...
1
vote
1answer
66 views

A modular version of LinearRecurrence?

I'm playing around with implementing the Lucas probable prime test (mainly so I can understand it better), and would love a version of the LinearRecurrence function that used addition modulo n (with n ...
4
votes
0answers
132 views

Prime factorization over the Eisenstein integers $\mathbb{Z}[\zeta]$

I am trying to write a function f[a_,b_] which takes in two integers $a,b$ and returns the unique factorization of $a+be^{2\pi i/3}$ into the primes belonging to $\...
2
votes
1answer
125 views

Riemann Prime Counting Function correction/pairing terms by Mathematica

Riemann Prime Counting Function: $$f(x)=\operatorname{li}(x)-\sum_\rho\operatorname{li}(x^\rho)-\ln 2+\int_x^\infty \frac{\mathrm dt}{t(t^2-1)\ln t}$$ The second correction/paring terms: $$\sum_\rho\...
3
votes
0answers
72 views

Prime Matrix with determinant of powers $2^x$

Mathematica has commands for finding prime matrices, for example, here is a matrix with randoms in the range $<100$: RandomPrime[100, {3, 3}] This $2 \times 2$ ...
9
votes
2answers
481 views

Evenly spaced Tick marks for Primes

I'm trying to have the integers evenly spaced on the x axis of a ListPlot, and the prime numbers evenly spaced on the y axis. ...
0
votes
0answers
73 views

Numerical comparison of two integrals and a function :

Consider the following integral: $$S(q)=\int_{x=2}^q\sin^2\left(\frac{π\Gamma(x)}{2x}\right)dx$$ And consider the functions : $$R(q)=\frac{q}{\log(q)}$$ $$T(q)=\int_2^q\frac{1}{\log(x)}dx$$ I ...
9
votes
4answers
1k views

Determining occurrence of a sequence of numbers in the first 50,000 primes

I have to determine how many of the first 50,000 prime numbers (digits) contain the sequence 5, 4, 3, in that order. The numbers don't have to necessarily be consecutive. For example, 566453 is a ...
4
votes
1answer
63 views

Condition for an integer exactly three primes factors? [closed]

I would like to count the number of integers n in the range [1, 10000] that satisfy all three of the properties below: n has ...
1
vote
1answer
76 views

Problem with Solve and PrimeZetaP

I assume this is something to do with limits on numerical precision, but can someone explain the difference in output between these two Solve problems: ...
4
votes
1answer
90 views
0
votes
0answers
31 views

Variant on `PrimeZetaP`

Mathematica has PrimeZetaP for the prime zeta function $\sum_p \frac{1}{p^s}$ where the sum is taken over all primes. How do I use Mathematica to make an ...
3
votes
1answer
236 views

Solve transcendental equation involving a built-in function [closed]

How can I solve an equation of the following form? $$x = 10+\mathrm{\mathbf{PrimePi}[x]}$$ where $x$ is an integer. I am using Solve but am getting the following ...
5
votes
0answers
63 views

How Prime[n] is implemented and why is that bounded? [duplicate]

How is Prime[n] implemented in Mathematica? I have just observed that calculating large primes is quite fast (but not in O(1) ...
0
votes
0answers
398 views

Identifying repeating patterns in a list of numbers

I have some generated lists of natural numbers which have a small number of distinct values, ie. referencing the variable "rowToCheck" for each list: list1: rowToCheck = 3: length=7, distinctvalues=3 ...
0
votes
1answer
94 views

Find the position of all the prime numbers up to a given number

I want Mathematica code the does what the following pseudocode does. ...
3
votes
2answers
199 views

Efficient way to list zeroes of an oscillating function

From "The First 50 Million Prime Numbers" by Don Zagier: primes are integral roots of$$ 1-\frac{\sin(\frac{\pi\Gamma(s)}s)}{\sin(\frac\pi s)}. $$ The graph of this function looks like I would like to ...
3
votes
4answers
166 views

The difference of Prime in Solve doesn't work

Can someone explain why Solve does not work with Prime difference? This cond does not work: Solve[Prime[n] - Prime[m] == 8, {n, m}, Integers] But you can find ...
1
vote
1answer
211 views

Finding recurrence formulas from procedural code and output lists associated with integer sequences

This code outputs 37 sequences and takes about 15-minutes to run. I would like to be able to see how many and which variables { i, j, k, m, n } each of the 37 ...
0
votes
0answers
40 views

First 3 unknown status for $R(n)$

Let R(1) = $1 - 1$ R(2) = $(1\times11) - (1+11)$ R(3) = $(1\times11\times111) - (1+11+111)$ R(4) = $(1\times11\times111\times1111) - (1+11+111+1111)$ R(4) is the only prime known with such form . ...
-1
votes
1answer
190 views

automatic formula finding function [duplicate]

I am curious how easy it would be to automatically find some formulas related to basic number theory OEIS sequences using some Mathematica search algorithm for a small set of OEIS sequences as a ...
2
votes
1answer
70 views

Prime factorization related functions: prime factor to its power and power of prime [duplicate]

FactorInteger can be used to perform prime factorization: FactorInteger[5^2 7^3 11^4] Results in: ...
1
vote
0answers
116 views

Integer sequence and RAM limits [closed]

I am trying to calculate the set of unique differences in a sequence, however the sequence grows fast and I hit the RAM limit of my PC for nthPrimeToUse = 11. For nthPrimeToUse 1 to 10 the output of ...