4
$\begingroup$

So whenever I square any number and subtract previous number of the original I always end up with a prime number. Why is it so? Let's say a number $x$ is squared and $x - 1$ is subtracted from it the result would be prime.

$\endgroup$
5
  • 6
    $\begingroup$ $25-4=21$, $64-7=57$... $\endgroup$
    – krirkrirk
    Commented Feb 25, 2018 at 20:31
  • $\begingroup$ Before you ever assume something, maybe you should go through a few values of $x$ before you even start typing on Math SE $\endgroup$
    – Xetrov
    Commented Feb 25, 2018 at 20:34
  • 1
    $\begingroup$ $10^2-9=100-9=91=13\cdot 7$ $\endgroup$ Commented Feb 25, 2018 at 20:36
  • 1
    $\begingroup$ If $x\equiv 2 \pmod(3),$ then $x^x-x+1$ is divisible by $3,$ so at least one-third of the examples you try will fail. You can't have tried very many. $\endgroup$
    – saulspatz
    Commented Feb 25, 2018 at 20:36
  • 2
    $\begingroup$ Go on Wolfram Alpha and put in Select[Table[n^2 - (n - 1), {n, 50}], Not[PrimeQ[#]] &] for plenty more counterexamples. $\endgroup$
    – Lisa
    Commented Feb 25, 2018 at 21:41

3 Answers 3

10
$\begingroup$

$5^2 - 4 = 25 - 4 = 21 = 7 \cdot 3$.

$\endgroup$
8
$\begingroup$

Maybe you've gotten lucky and only tested numbers drawn from Sloane's A055494:

A055494 Numbers $n$ such that $n^2 - n + 1$ is prime. ... 2, 3, 4, 6, 7, 9, 13, 15, 16, 18, 21, 22, 25, 28, 34, 39, 42, 51, 55, 58, 60, 63, 67, 70, 72, 76, 78, 79, 81, 90, 91, 100, 102, 106, 111, 112, 118, 120, 132, 139, 142, 144, 148, 151, 154, 156, 162, 163, 165, 168, 169, 174, 177, 189, 190, 193, 195, 204, 207, 210, 216

Obviously $n^2 - n$ is a multiple of $n$. But $n^2 - n + 1$ is coprime to $n$, meaning that it has no prime factors in common with $n$. So it will sometimes happen that $n^2 - n + 1$ is actually itself prime.

For example, $8^2 - 8 + 1 = 57 = 3 \times 19$. So 8 is a power of 2, while 57 is an odd number, the product of two odd primes. 57 is not prime, but it still has no prime factors in common with 8.

Compare that to 9, which gives us $9^2 - 9 + 1 = 73$, which is indeed prime.

$\endgroup$
6
$\begingroup$

Note that

$$x^2-(x-1)=(x+\sqrt{x-1})(x-\sqrt{x-1})$$

thus for counterexamples it suffices that $x-1$ is a square.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .