Showing posts with label Legendre. Show all posts
Showing posts with label Legendre. Show all posts

Wednesday, 30 July 2025

A Well-Known Legendre Prime-Producing Polynomial

 Here is what Gemini had to say about the prime-producing polynomial \( 2 k^2+29\):

The polynomial \( 2 k^2+29\) is a well-known example of a prime-producing polynomial, often associated with the French mathematician Adrien-Marie Legendre. Here's a breakdown of its discovery, usage, and prime-producing potential:

Discovery:

  • Adrien-Marie Legendre (1752-1833) is credited with the discovery of the polynomial \( 2  k^2+29\). He published this result in his work "Essai sur la théorie des nombres" in 1798.

  • This came in the wake of significant work on prime-generating polynomials, notably Euler's polynomial \(k^2+k+41\), which generates primes for 40 consecutive integer values. Legendre's work further explored this fascinating property in different polynomial forms.

Usage and Significance:

  • Illustrates Prime-Generating Properties: While no non-constant polynomial with integer coefficients can generate only prime numbers for all integer values (this has been proven), polynomials like \( 2 k^2+29\) are significant because they produce a surprisingly long sequence of prime numbers for consecutive integer inputs.

  • Connection to Class Number Theory: The behavior of such prime-producing quadratic polynomials is deeply connected to the theory of class numbers in imaginary quadratic fields. The fact that \( 2 k^2+29\) (and other similar polynomials like Euler's \(k^2+k+41\)) produce so many primes is not a coincidence but is tied to specific properties of the corresponding quadratic fields.

  • Educational and Recreational Mathematics: These polynomials are frequently used in number theory courses and popular science to demonstrate the elusive nature of prime number distribution and the intriguing patterns that can emerge. They serve as excellent examples to explore the question of "prime-generating formulas."

  • In Popular Culture: The sequence of primes generated by \( 2 k^2+29\) has even appeared in popular culture, such as in Ken Follett's novel "Code to Zero."

Prime-Producing Potential:

  • The polynomial \( \text{P}(k)= 2 k^2+29 \) generates prime numbers for a remarkable number of consecutive integer values of \(k\). Specifically, it produces primes for \(k=0,1,2, \dots 28\). This means it generates 29 consecutive primes starting from .

  • Let's list the first few:

    • \( \text{P}(0)=2 \times 0^2+29=29 \) (prime)

    • \( \text{P}(1)=2 \times 1^2+29=31\) (prime)

    • \( \text{P}(2)=2 \times 2^2+29=37 \) (prime)

    • \( \text{P}(3)=2 \times 3^2+29=47 \) (prime)

    • ...and so on, up to \( \text{P}(28) \).

  • For \(k=29\)$$\text{P}(29)=2 \times 29^2+29=29 \, (2×29+1)=29 \times 59$$which is a composite number. This illustrates the general principle that no such polynomial can produce primes indefinitely.

In summary, Legendre's polynomial \( 2 k^2+29\) is a notable discovery in number theory, demonstrating an impressive string of prime outputs for consecutive integer inputs. Its significance lies in its historical context alongside other prime-generating polynomials like Euler's, its connection to deeper number theoretic concepts like class numbers, and its role as a compelling example in the study of prime numbers.

The polynomial popped up because of a reference to it in OEIS A241554: composite numbers of the form \(2  k^2 + 29\). The number associated with my diurnal age today, 27877, is a member of this sequence:$$ \begin{align} \text{If }k &=118 \\ 2k^2+29 &= 2 \times 118^2+29 \\ &= 27877 \\ &=61 \times 457 \end{align}$$When this polynomial is not busy churning out primes, it is busy churning out semiprimes. In fact, it is only when \(k=185\) that we get a number that is not a prime or a semiprime:$$\begin{align} \text{If }k &=185 \\ 2k^2+29 &= 2 \times 185^2+29 \\ &= 68479 \\ &=31 \times 47^2 \end{align}$$Follow this permalink to generate a table of these numbers and their factors. Here is a list of the members of OEIS A241554 between 1 and 40000:

1711, 1829, 2077, 2479, 3071, 3901, 5029, 6527, 6757, 7471, 7967, 8479, 10397, 10981, 11581, 14141, 15167, 15517, 15871, 16591, 16957, 17701, 18079, 18847, 19631, 20837, 22927, 23791, 25567, 26941, 27877, 28829, 29797, 30287, 31279, 31781, 32287, 35941, 38117

The table below shows the factorisations of the previous numbers as well as the corresponding \(k\) values:

  k     2*k^2+29   factors

  29    1711       29 * 59
  30    1829       31 * 59
  32    2077       31 * 67
  35    2479       37 * 67
  39    3071       37 * 83
  44    3901       47 * 83
  50    5029       47 * 107
  57    6527       61 * 107
  58    6757       29 * 233
  61    7471       31 * 241
  63    7967       31 * 257
  65    8479       61 * 139
  72    10397      37 * 281
  74    10981      79 * 139
  76    11581      37 * 313
  84    14141      79 * 179
  87    15167      29 * 523
  88    15517      59 * 263
  89    15871      59 * 269
  91    16591      47 * 353
  92    16957      31 * 547
  94    17701      31 * 571
  95    18079      101 * 179
  97    18847      47 * 401
  99    19631      67 * 293
  102   20837      67 * 311
  107   22927      101 * 227
  109   23791      37 * 643
  113   25567      37 * 691
  116   26941      29 * 929
  118   27877      61 * 457
  120   28829      127 * 227
  122   29797      83 * 359
  123   30287      31 * 977
  125   31279      31 * 1009
  126   31781      61 * 521
  127   32287      83 * 389
  134   35941      127 * 283
  138   38117      47 * 811

There are 103 primes in the range up to 40000 that are generated by this polynomial. These start with \(k=0\):

29, 31, 37, 47, 61, 79, 101, 127, 157, 191, 229, 271, 317, 367, 421, 479, 541, 607, 677, 751, 829, 911, 997, 1087, 1181, 1279, 1381, 1487, 1597, 1951, 2207, 2341, 2621, 2767, 2917, 3229, 3391, 3557, 3727, 4079, 4261, 4447, 4637, 4831, 5231, 5437, 5647, 5861, 6079, 6301, 6991, 7229, 7717, 8221, 8741, 9007, 9277, 9551, 9829, 10111, 10687, 11279, 11887, 12197, 12511, 12829, 13151, 13477, 13807, 14479, 14821, 16229, 17327, 18461, 19237, 20029, 20431, 21247, 21661, 22079, 22501, 23357, 24229, 24671, 25117, 26021, 26479, 27407, 28351, 29311, 30781, 32797, 33311, 33829, 34351, 34877, 35407, 36479, 37021, 37567, 38671, 39229, 39791

Saturday, 25 August 2018

Quadratic Reciprocity

I just read a most interesting article in Quanta Magazine about the new Fields medallist Peter Scholze. His discoveries are quite beyond my comprehension but in the article mention is made of quadratic reciprocity. I've come across the concept repeatedly but have always avoided taking the time to understand it. However, in this article it was explained simply and clearly. 
Reciprocity laws are generalisations of the 200-year-old quadratic reciprocity law, a cornerstone of number theory and one of Scholze’s personal favourite theorems. The law states that given two prime numbers p and q, in most cases p is a perfect square on a clock with q hours exactly when q is a perfect square on a clock with p hours. For example, five is a perfect square on a clock with 11 hours, since \(5 = 16 = 4^2 \), and 11 is a perfect square on a clock with five hours, since \(11 = 1 = 1^2 \).
Here is a more detailed explanation of quadratic reciprocity (source):
It's easy to find integer solutions of the equation \( y^2 = 2x^2 + 7k \), but there are no integer solutions at all of the seemingly similar equation \( y^2 = 3x^2 + 7k \).  This is the sort of thing that experienced number theorists can tell at a glance, simply by noting that the equations written modulo 7 are \( y^2 = 2x^2 \) and \( y^2 = 3x^2 \) respectively, and since division is unique in the field of integers (mod p) we have \( (y/x)^2 \equiv n \pmod{p} \), which implies that n must be the square of some element of the field of integers modulo p.  But the integers mod 7 are just 0, 1, 2, 3, 4, 5, 6, whose squares (mod 7) are 0, 1, 4, 2, 2, 4, 1. Thus the equation \( y^2 = nx^2 + 7k \) can have integer solutions only if n is congruent to 0, 1, 2, or 4 (mod 7).  These are called the quadratic residues (mod 7), and the remaining numbers 3, 5, 6 are called the non-quadratic residues.  
It's often extremely important when dealing with problems in number theory to know whether a certain prime p is a square (i.e., a quadratic residue) modulo some other particular prime q. Legendre defined a symbol to represent this information, which we will denote as
This is a remarkable fact, and not at all self-evident.  Legendre succeeded in proving some special cases of this, and also gave what he thought was a complete proof, but his argument relied on the premise that every arithmetic progression contains infinitely many primes. This is in fact true, as subsequently shown by Dirichlet, but at the time of Legendre's proof it wasn't known, so Gauss pointed out that Legendre's proof was incomplete. Gauss went even further, and gave several (valid) proofs of this remarkable theorem, which he called the Fundamental Theorem of number theory.
Thus [p\q] equals either +1 or -1 depending on whether p is or isn't a square modulo q. From examining many individual cases, Euler had previously noticed a striking relationship between the [p\q] and [q\p].  Specifically, he noticed that [p\q] = [q\p] except when p and q are both of the form 4k-1, in which case [p\q] = -[q\p]. 
Let's take a specific example. Yesterday I turned 25339 days old. The previous prime is 25321. It can seen that \( 25339 \equiv 18 \pmod{25321} \) and \( 25321 \equiv 25321 \pmod{253339} \), neither residue being square. Therefore \([25339\25321] = [25321\25339] = -1\). Note that 25321 is a 4k+1 prime while 25339 is a 4k-1 prime, which is in accord with the theorem.



I've download a PDF titled Quadratic Residues and Non-Residues Selected Topics by Steve Wright from the Department of Mathematics and Statistics Oakland University, Rochester, Michigan and dated 21st October 2106. It's freely available here. I'll have a read over this and see if I can deepen my understanding of this topic.

Here are some SAGE commands that can be used when dealing with quadratic residues (double click to enlarge):


Source: http://doc.sagemath.org/html/en/constructions/number_theory.html
ADDENDUM:

When trying to tackle the above Quadratic Residues and Non-Residues Selected Topics, I quickly realised that my foundations in modular arithmetic were a little shaky and needed to be reinforced a little. I began watching a series of videos by Polar Pi on YouTube, beginning with this video on a linear congruence equation with one solution:



The next video in this series relates to linear congruence equations with multiple solutions and the third of the three videos looks at linear congruence equations with no solutions.

The YouTube channel blackpenredpen has some videos on modular arithmetic as well:
  • What does a ≡ b (mod n) mean? Basic Modular Arithmetic, Congruence? Link
  • Solving congruences, 3 introductory examples. Link
  • System of congruences, modular arithmetic. Link

Friday, 24 February 2017

Sums of Squares Revisited

My first post for this mathematics blog concerned the conditions required for a number to be expressible as the sum of two squares. The date was 26th September 2015. I thought I might start revisiting some of my earlier posts just to reacquaint myself with their content. Let's consider prime numbers first. Fermat's theorem on the sums of two squares states that any prime number that is congruent to 1 modulus 4 can be expressed as a sum of two squares.

In other words, if \(p\) is a prime, then \(p=x^2+y^2\) where \(x\) and \(y\) are integers, if and only if \(p \equiv 1 \pmod{4}\). Applied to my current day count of \(24799\) (a prime), we find that \(24799 \equiv 3 \pmod{4}\) and so it cannot be written as the sum of two squares. In fact, it cannot even be written as the sum of three squares because the number can be expressed in the form \(4^a(8b+7)\) with \(a=0\) and \(b=3099\). By Legendre's 3-square theorem, such a number cannot be expressed as a sum of three squares.

Primes that can be expressed as the sum of two squares are called Pythagorean Primes.

If the number is composite, none of its \(4k+3\) primes can have an odd exponent. For example, two days ago I was \(24797\) days old and this number factorises to \(137 \times 181\). Now \(137 \equiv 1 \pmod{4}\) and \(181 \equiv 1 \pmod{4}\), so there are no \(4k+3\) primes and thus the number is expressible as a sum of two squares (in two different ways as it turns out): \(24797=59^2+146^2=74^2+139^2\).

There is a reason that \(24797\) can be expressed as a sum of squares in two different ways. Remember that its factors \(137\) and \(181\) are both primes satisfying \(p \equiv 1 \pmod{4}\) and so each can be expressed as a sum of two squares. Specifically, \(137=4^2+11^2\) and \(181=9^2+10^2\). It can easily be shown that the product of two sums of squares is equal to a sum of squares in two different ways. Here is the demonstration: $$(a^2+b^2)(c^2+d^2)=(ac-bd)^2+(ad+bc)^2=(ac+bd)^2+(ad-bc)^2$$There is an interesting history attached to this identity:
It is actually first found in Diophantus' Arithmetica (III, \(19\)), of the third century A.D. It was rediscovered by Brahmagupta (\(598\)–\(668\)), an Indian mathematician and astronomer, who generalised it (to the Brahmagupta identity) and used it in his study of what is now called Pell's equation. His Brahmasphutasiddhanta was translated from Sanskrit into Arabic by Mohammad al-Fazari, and was subsequently translated into Latin in \(1126\). The identity later appeared in Fibonacci's Book of Squares in \(1225\). Source.
However, take yesterday's number \(24798=2 \times 3 \times 4133\). Clearly, \(3\) is a \( 4k+3\) prime raised to an odd power and so \(24798\) cannot be expressed as sum of two squares. As it happens, \(4133 \equiv 1 \pmod{4}\) but that doesn't matter because \(3\) has already ruined things.