cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A097343 Triangle read by rows in which row n gives Legendre symbol (k,p) for 0 where p = n-th prime.

This page as a plain text file.
%I A097343 #21 Nov 13 2016 17:07:03
%S A097343 1,-1,0,1,-1,-1,1,0,1,1,-1,1,-1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,
%T A097343 1,1,-1,-1,-1,-1,1,1,-1,1,0,1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,1,0,
%U A097343 1,-1,-1,1,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,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,0,1,-1,-1,1,1,1,1
%N A097343 Triangle read by rows in which row n gives Legendre symbol (k,p) for 0<k<=p where p = n-th prime.
%C A097343 Row sums = 0. (p,k)==k^((p-1)/2) (mod p). For example, row n=4 of the triangle (for the 4th prime p = 7) reads: 1,1,-1,1,-1,-1,0 because 1^3==1, 2^3==1, 3^3==-1, 4^3==1, 5^3==-1, 6^3==-1, 7^3==0 (mod 7). - _Geoffrey Critzer_, Apr 18 2015
%H A097343 Reinhard Zumkeller, <a href="/A097343/b097343.txt">Rows n = 2..75 of triangle, flattened</a>
%H A097343 Haskell for Math, <a href="https://github.com/algal/projecteuler/blob/master/haskellformath/NumberTheoryFundamentals.hs">Number Theory Fundamentals</a>
%H A097343 Wikipedia, <a href="http://en.wikipedia.org/wiki/Legendre_symbol">Legendre symbol</a>
%F A097343 (p, p)=0, all others are +- 1.
%e A097343 1,-1,0 ; # A102283
%e A097343 1,-1,-1,1,0; # A080891
%e A097343 1,1,-1,1,-1,-1,0; # A175629
%e A097343 1,-1,1,1,1,-1,-1,-1,1,-1,0; # A011582
%p A097343 with(numtheory):
%p A097343 T:= n-> (p-> seq(jacobi(k, p), k=1..p))(ithprime(n)):
%p A097343 seq(T(n), n=2..15);  # _Alois P. Heinz_, Apr 19 2015
%t A097343 Flatten[ Table[ JacobiSymbol[ Range[ Prime[n]], Prime[n]], {n, 2, 8}]]
%o A097343 (Haskell)
%o A097343 a097343 n k = a097343_tabf !! (n-2) !! (k-1)
%o A097343 a097343_row n = a097343_tabf !! (n-2)
%o A097343 a097343_tabf =
%o A097343    map (\p -> map (flip legendreSymbol p) [1..p]) $ tail a000040_list
%o A097343 legendreSymbol a p = if a' == 0 then 0 else twoSymbol * oddSymbol where
%o A097343    a' = a `mod` p
%o A097343    (s,q) = a' `splitWith` 2
%o A097343    twoSymbol = if (p `mod` 8) `elem` [1,7] || even s then 1 else -1
%o A097343    oddSymbol = if q == 1 then 1 else qrMultiplier * legendreSymbol p q
%o A097343    qrMultiplier = if p `mod` 4 == 3 && q `mod` 4 == 3 then -1 else 1
%o A097343    splitWith n p = spw 0 n where
%o A097343       spw s t = if m > 0 then (s, t) else spw (s + 1) t'
%o A097343                 where (t', m) = divMod t p
%o A097343 -- See link.  _Reinhard Zumkeller_, Feb 02 2014
%Y A097343 See A226520 for another version.
%Y A097343 Cf. A068717.
%K A097343 sign,tabf
%O A097343 2,1
%A A097343 _Robert G. Wilson v_, Aug 02 2004