Questions tagged [primality-test]

An algorithm for determining whether an input number is prime.

A primality test is an algorithm for determining whether an input number is prime. Among other fields of mathematics, it is used for cryptography. Unlike integer factorization, primality tests do not generally give prime factors, only stating whether the input number is prime or not. Factorization is thought to be a computationally difficult problem, whereas primality testing is comparatively easy (its running time is polynomial in the size of the input).

364 questions
44
votes
4 answers

Does $(n+1)(n-2)x_{n+1}=n(n^2-n-1)x_n-(n-1)^3x_{n-1}$ with $x_2=x_3=1$ define a sequence that is integral at prime indices?

My son gave me the following recurrence formula for $x_n$ ($n\ge2$): $$(n+1)(n-2)x_{n+1}=n(n^2-n-1)x_n-(n-1)^3x_{n-1}\tag{1}$$ $$x_2=x_3=1$$ The task I got from him: The sequence has an interesting property, find it out. Make a conjecture and…
31
votes
2 answers

Conjectured primality test

Can you provide a proof or a counterexample for the following claim : Let $n$ be a natural number , $n>2$ and $n \neq 9$ . Then $n$ is prime if and only if $\displaystyle\sum_{k=1}^{n-1}\left(2^k-1\right)^{n-1} \equiv n \pmod{2^n-1}$ You can run…
28
votes
5 answers

Split $n$ into nontrivial factors via a nontrivial square-root of $1\!\pmod{\!n}$

Coming from an understanding of Fermat's primality test, I'm looking for a clear explanation of the Miller-Rabin primality test. Specifically: I understand that for some reason, having non-trivial square roots of 1 mod p means that p is definitely…
Smashery
  • 455
  • 1
  • 5
  • 8
27
votes
11 answers

A quick way, say in a minute, to deduce whether $1037$ is a prime number

So with $1037 = 17 \cdot 61$, is there a fast method to deduce that it's not a prime number? Say $1037 = 10^3+6^2+1$. Does $a^3 + b^2 + 1$ factorize in some way? As part of their interviews, a company is asking whether a number is prime. I have…
25
votes
3 answers

$n$ is prime iff $\binom{n^2}{n} \equiv n \pmod{n^4}$?

Can you prove or disprove the following claim: Let $n$ be a natural number greater than two , then $$n \text{ is prime iff } \binom{n^2}{n} \equiv n \pmod{n^4}$$ You can run this test here. I have verified this claim for all $n$ up to $100000$ .
21
votes
2 answers

How to either prove or disprove if it is possible to arrange a series of numbers such the sum of any two adjacent number adds up to a prime number

I'm wondering if it's possible to write a theorem to prove or disprove the possibility of arranging a sequence of numbers (1,2,...n) such that the sum of any two numbers adds up to a prime number. An Example: Input: Say n=7. The sequence is…
17
votes
2 answers

Primality testing for 64 bit numbers

For very small numbers, say 32 bits unsigned, testing all divisors up to the square root is a very decent approach. Some optimizations can be made to avoid trying all divisors, but these yield marginal improvements. The complexity remains $O(\sqrt…
user65203
16
votes
1 answer

How do you prove a number is prime?

I am a software engineer but try to keep up with maths as I really enjoyed the subject at school. I just saw a great TED talk: Why I fell in love with monster prime numbers The talk states that the current largest known prime is…
Mufasa
  • 5,345
  • 1
  • 16
  • 25
15
votes
2 answers

Most efficient algorithm for nth prime, deterministic and probabilistic?

What's the most efficient algorithm for calculating an $nth$ prime, both deterministically and probabilistically? Deterministic Iterate through only odd values, incrementing by $2$. Divide each value by $2 < divisor < \sqrt{value}$, where…
15
votes
1 answer

Why is factorization of large number hard

Why factoring a number is difficult compared to finding out if it is prime (which can be done in polynomial time) ? I would think they might be of similar difficulty in terms of computational complexity.
15
votes
3 answers

Mental Primality Testing

At a trivia night, the following question was posed: "What is the smallest 5 digit prime?" Teams (of 4) were given about a minute to write down their answer to the question. Obviously, the answer is googleable, so I'm not asking what the answer to…
12
votes
1 answer

Primality testing with binomial coefficients

Here is what I observed : Let $n$ be a natural number greater than 2. Let $A = 2\cdot\binom{3n+1}{n}-\binom{3n}{n-1}+\binom{3n-1}{n-2}$ Let $p=2n+1$ $p$ is prime iff $A \equiv 2 \pmod{p}$ You can run this test here. I tried with some prime and…
12
votes
1 answer

Is This a New Property I Have Found Pertaining to Mersenne Primes?

While playing with Mersenne numbers, I found the following property distinguishing Mersenne prime numbers from Mersenne composite numbers. A Mersenne number, $\text{M}p$, is a number of the form $2^p - 1$, where $p$ is prime. Property For $p > 2$,…
12
votes
1 answer

Primality test for Proth numbers using Fibonacci numbers

How to prove or disprove the claim given below ? Let $$P_j(x)=2^{-j}\cdot \left((x-\sqrt{x^2-4})^{j}+(x+\sqrt{x^2-4})^{j}\right),$$ where $j$ and $x$ are nonnegative integers. Let $$N=k \cdot2^m+1$$ with $k$ odd , $02$. Let $F_n$ be…
11
votes
3 answers

What does $\!\bmod(n,x^r-1)$ mean? [in AKS primality test]

Where does a layman go to get a basic understanding of AKS primality testing. I am not talking about the optimal choice of $r$ (which I am told is the hardcore number-theoretic part of the algorithm). I mean basic things, like what does $\bmod(n,…
Gary
  • 111
  • 3
1
2 3
24 25