login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A372726 Legendre's triangle read by rows. T(n, k) = L(n / prime(k)) where L(n/p) is the Legendre symbol, for n >= 0 and 2 <= k <= n + 2. 7

%I #28 Jul 09 2024 17:39:10

%S 0,1,1,-1,-1,1,0,-1,-1,1,1,1,1,1,1,-1,0,-1,1,-1,-1,0,1,-1,-1,-1,-1,1,

%T 1,-1,0,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,0,1,1,1,1,1,1,1,1,1,1,0,

%U -1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,0,-1,-1,1,-1,-1,-1,1,-1

%N Legendre's triangle read by rows. T(n, k) = L(n / prime(k)) where L(n/p) is the Legendre symbol, for n >= 0 and 2 <= k <= n + 2.

%H Paolo Xausa, <a href="/A372726/b372726.txt">Table of n, a(n) for n = 0..11475</a> (rows 0..150 of the triangle, flattened).

%H Adrien Marie Legendre, <a href="https://www.e-rara.ch/zut/content/structure/1089237">Essai sur la théorie des nombres</a>, Paris, Duprat, an VI [1798]. <a href="https://www.e-rara.ch/zut/content/pageview/1089453">Introducing the symbol</a>, p. 186.

%F T(n, k) = r - p*[r > 1] where r = n^v mod p, p = prime(k), v = (p - 1)/2, and [.] are the Iverson brackets.

%e Triangle starts:

%e [ 0] 0;

%e [ 1] 1, 1;

%e [ 2] -1, -1, 1;

%e [ 3] 0, -1, -1, 1;

%e [ 4] 1, 1, 1, 1, 1;

%e [ 5] -1, 0, -1, 1, -1, -1;

%e [ 6] 0, 1, -1, -1, -1, -1, 1;

%e [ 7] 1, -1, 0, -1, -1, -1, 1, -1;

%e [ 8] -1, -1, 1, -1, -1, 1, -1, 1, -1;

%e [ 9] 0, 1, 1, 1, 1, 1, 1, 1, 1, 1;

%e [10] 1, 0, -1, -1, 1, -1, -1, -1, -1, 1, 1;

%e .

%e Not limiting the range of k leads to the square array:

%e .

%e [n\p] 3, 5, 7, 11, 13, 17, 19, 23, 29, 31

%e -----------------------------------------------

%e [0] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...

%e [1] 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...

%e [2] -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, ...

%e [3] 0, -1, -1, 1, 1, -1, -1, 1, -1, -1, ...

%e [4] 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...

%e [5] -1, 0, -1, 1, -1, -1, 1, -1, 1, 1, ...

%e [6] 0, 1, -1, -1, -1, -1, 1, 1, 1, -1, ...

%e [7] 1, -1, 0, -1, -1, -1, 1, -1, 1, 1, ...

%e [8] -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, ...

%e [9] 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...

%e ...

%p L := (n, k) -> NumberTheory:-LegendreSymbol(n, ithprime(k)):

%p for n from 0 to 10 do lprint([n], seq(L(n, k), k = 2..n + 2)) od;

%t Array[JacobiSymbol[#, Prime[Range[2, #+2]]]&, 15, 0] (* _Paolo Xausa_, Jul 09 2024 *)

%o (Python)

%o from sympy import primerange, prime, legendre_symbol

%o for n in range(11):

%o print([n], [legendre_symbol(n, p) for p in primerange(3, prime(n + 2) + 1)])

%o # For illustration of the formula (Sympy's implementation is more efficent):

%o def LegendreSymbol(n, p):

%o v = (p - 1) // 2

%o res = pow(n, v, p)

%o return res - p if res > 1 else res

%Y Family: A217831 (Euclid's triangle), A372877 (Jacobi's triangle), A372728 (Kronecker's triangle), A373223 (Gauss' triangle), A373751 (quadratic residue modulo prime(n)), A373748 (quadratic residue/nonresidue modulo n).

%Y Cf. A372725 (row sums).

%K sign,tabl

%O 0

%A _Peter Luschny_, May 22 2024

%E Data corrected by _Paolo Xausa_, Jul 09 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 29 22:36 EDT 2024. Contains 374734 sequences. (Running on oeis4.)