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.

Showing 1-3 of 3 results.

A174960 Smallest prime p such that p + n*(n+1)/2 is prime, or 0 if no such prime exists.

Original entry on oeis.org

2, 2, 2, 5, 3, 2, 2, 3, 5, 2, 0, 5, 5, 0, 2, 7, 3, 0, 2, 3, 13, 2, 0, 5, 7, 0, 2, 5, 3, 0, 2, 3, 13, 2, 0, 11, 7, 0, 2, 7, 3, 2, 0, 7, 7, 0, 0, 23, 5, 0, 2, 41, 3, 2, 2, 3, 5, 0, 0, 7, 17, 0, 0, 11, 3, 0, 2, 3, 5, 2, 0, 23, 5, 0, 2, 7, 13, 0, 2, 3, 11, 2, 0, 5, 11, 0, 0, 5, 3, 2, 0, 31, 5, 2, 0, 7, 7, 0, 0
Offset: 0

Views

Author

Michel Lagneau, Apr 02 2010

Keywords

Comments

n(n+1)/2 = A000217(n).
If n(n+1)/2 is odd, m+n(n+1)/2 can be prime only for m = 2, since otherwise m+n(n+1)/2 is divisible by 2. Hence a(n) = 0 if n(n+1)/2 is odd and 2+n(n+1)/2 is not prime.
For n > 0 also smallest m such that all eigenvalues of the n X n matrix M_m,n are prime, where M_m,n(j,k) = j for j <> k, M_m,n(j,k) = m+j for j = k.
The eigenvalues of M_m,n are m+n(n+1)/2, and m with the multiplicity n-1; cf. reference for proof. Thus all eigenvalues can be prime only if m is prime.

Examples

			(in Maple notation)
For n = 1 and m = 2, eigenvals(matrix(1,1, [[3]])) = {3}, so a(1) = 2.
For n = 2 and m = 2, eigenvals(matrix(2,2, [[3,1],[2,4]]) = {2,5} so a(2) = 2.
For n = 3 and m = 2, eigenvals(matrix(3,3, [[3,1,1],[2,4,2],[3,3,5]])) = {2,2,8} and 8 is not prime; for m = 3, eigenvals(matrix(3,3, [[4,1,1],[2,5,2],[3,3,6]])) = {3,3,9} and 9 is not prime; for m = 5, eigenvals(matrix(3,3, [[6,1,1],[2,7,2],[3,3,8]])) = {5,5,11} and 11 is prime, so a(3) = 5;
		

References

  • J.-M. Monier, Algebre et geometrie, exercices corriges. Dunod, 1997, p. 78.

Crossrefs

Cf. A000217 (triangular numbers), A174962.

Programs

  • Magma
    SmallestP:=function(n) for p in PrimesUpTo(1000) do if IsPrime(p + n*(n+1) div 2) then return p; end if; end for; return 0; end function; [SmallestP(n): n in [0..100]]; // Klaus Brockhaus, Apr 10 2010
    
  • Magma
    SmallestQ:=function(n) for m in PrimesUpTo(1000) do E:=Eigenvalues(Matrix([&cat[ [j ne k select j else m+j]: k in [1..n]]: j in [1..n] ])); if forall(t){x: x in E | IsPrime(x[1])} then return m; end if; end for; return 0; end function; [2] cat [SmallestQ(n): n in [1..100]]; // Klaus Brockhaus, Apr 10 2010
  • Maple
    with(numtheory):for n from 1 to 200 do:nn:=1:for k from 2 to 1000 do: x:=k + n*(n+1)/2:if (type(x,prime)=true)and(type(k,prime)=true)and nn=1 then print(k):nn:=2:else fi:od:od:
  • Mathematica
    a[n_] := (p = 2; q = n*(n+1)/2; While[p > 0, If[ PrimeQ[p+q], Break[], p = If[ OddQ[q], 0, NextPrime[p]]]]; p); Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Nov 03 2011 *)

Extensions

Edited and corrected by Klaus Brockhaus, Apr 10 2010

A174963 Determinant of the symmetric n X n matrix M_n where M_n(j,k) = n for j = k, M_n(j,n) = n-j, M_n(n,k) = n-k, M_n(j,k) = 0 otherwise.

Original entry on oeis.org

1, 3, 12, 32, -625, -24624, -705894, -19922944, -588305187, -18500000000, -622498190424, -22414085849088, -862029149531797, -35320307409809408, -1537494104003906250, -70904672533321089024, -3454944623172347662151, -177423154932124201844736
Offset: 1

Views

Author

Michel Lagneau, Apr 02 2010

Keywords

Examples

			a(5) = det(M_5) = -625 where M_5 is the matrix
  [5 0 0 0 4]
  [0 5 0 0 3]
  [0 0 5 0 2]
  [0 0 0 5 1]
  [4 3 2 1 5]
		

References

  • J.-M. Monier, Algèbre et géometrie, exercices corrigés. Dunod, 1997, p. 78.

Crossrefs

Cf. A174962.

Programs

  • Magma
    [ n^n -((n-1)*n*(2*n-1)/6)*n^(n-2): n in [1..18] ]; // Klaus Brockhaus, Apr 11 2010
    
  • Magma
    [ Determinant( SymmetricMatrix( &cat[ [ i lt j select 0 else n: i in [1..j] ]: j in [1..n-1] ] cat [ 1+((n-1-k) mod n): k in [1..n] ] ) ): n in [1..18] ]; // Klaus Brockhaus, Apr 11 2010
  • Maple
    with(numtheory):for n from 1 to 25 do:x:=n^n -((n-1)*n*(2*n-1)/6)*n^(n-2):print(x):od:
  • Mathematica
    M[j_,k_,n_]:=If[j==k,n,If[k==n,n-j,If[j==n,n-k,0]]]; a[n_]:=Det[Table[M[i,j,n],{i,n},{j,n}]]; Array[a,18] (* Stefano Spezia, Aug 11 2025 *)

Formula

a(n) = n^n - ((n-1)*n*(2*n-1)/6)*n^(n-2).

Extensions

Edited by Klaus Brockhaus, Apr 11 2010

A386975 a(n) is the permanent of the n X n matrix M_n with M_n(j,k) = j for j <> k, M_n(j,k) = n+j for j = k.

Original entry on oeis.org

1, 2, 14, 183, 3792, 114780, 4807728, 267380071, 19098388480, 1705287529422, 186174804704000, 24402257980061599, 3781731531452940288, 684046276855242721368, 142823583210894978115584, 34092816821609506532859375, 9226267072346511233190461440, 2809774286001810901571097532538
Offset: 0

Views

Author

Stefano Spezia, Aug 11 2025

Keywords

Examples

			a(5) = permanent(M_5) = 114780 where M_5 is the matrix
  [6, 1, 1, 1,  1]
  [2, 7, 2, 2,  2]
  [3, 3, 8, 3,  3]
  [4, 4, 4, 9,  4]
  [5, 5, 5, 5, 10]
		

Crossrefs

Cf. A174962 (determinants), A386974.

Programs

  • Mathematica
    M[j_,k_,n_]:=If[j!=k,j,If[j==k,n+j]]; a[n_]:=Permanent[Table[M[i,j,n],{i,n},{j,n}]];Join[{1}, Array[a,17]]
  • PARI
    a(n) = matpermanent(matrix(n, n, j, k, if (j==k, n+j, j))); \\ Michel Marcus, Aug 12 2025
Showing 1-3 of 3 results.