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.
%I A174960 #15 Sep 08 2022 08:45:51 %S A174960 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, %T A174960 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, %U A174960 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 %N A174960 Smallest prime p such that p + n*(n+1)/2 is prime, or 0 if no such prime exists. %C A174960 n(n+1)/2 = A000217(n). %C A174960 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. %C A174960 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. %C A174960 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. %D A174960 J.-M. Monier, Algebre et geometrie, exercices corriges. Dunod, 1997, p. 78. %H A174960 K. Brockhaus, <a href="/A174960/b174960.txt">Table of n, a(n) for n = 0..10000</a> %e A174960 (in Maple notation) %e A174960 For n = 1 and m = 2, eigenvals(matrix(1,1, [[3]])) = {3}, so a(1) = 2. %e A174960 For n = 2 and m = 2, eigenvals(matrix(2,2, [[3,1],[2,4]]) = {2,5} so a(2) = 2. %e A174960 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; %p A174960 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: %t A174960 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 *) %o A174960 (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 %o A174960 (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 %Y A174960 Cf. A000217 (triangular numbers), A174962. %K A174960 nonn %O A174960 0,1 %A A174960 _Michel Lagneau_, Apr 02 2010 %E A174960 Edited and corrected by _Klaus Brockhaus_, Apr 10 2010