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.

A109905 a(n) = greatest prime of the form k*(n-k) +1. 0 if no such prime exists.

This page as a plain text file.
%I A109905 #22 Jul 25 2023 08:49:02
%S A109905 0,2,3,5,7,0,13,17,19,17,31,37,43,41,37,61,73,73,89,101,109,113,131,
%T A109905 109,157,89,181,197,211,0,241,257,271,281,307,181,337,353,379,401,421,
%U A109905 433,463,449,487,521,547,577,601,617,631,677,701,0,757,769,811,761,859,757
%N A109905 a(n) = greatest prime of the form k*(n-k) +1. 0 if no such prime exists.
%C A109905 k can take values from 1 to floor[n/2].
%C A109905 a(n)=0 for k = 1, 6, 30 and 54.  Are there any others? - _Robert Israel_, Feb 23 2018
%C A109905 There are none for n up to 10^9. - _Mauro Fiorentini_, Jul 24 2023
%H A109905 Ivan Neretin, <a href="/A109905/b109905.txt">Table of n, a(n) for n = 1..10000</a>
%e A109905 a(15) = 37 as 1*14 +1 = 16, 2*13 +1 = 27 are composite but 3*12 +1= 37 is a prime.
%e A109905 a(6) = 0 as 1*5 +1=6, 2*4 +1=9, 3*3 +1 = 10 are all composite.
%p A109905 f:= proc(n) local k;
%p A109905   for k from floor(n/2) to 1 by -1 do
%p A109905     if isprime(k*(n-k)+1) then return k*(n-k)+1 fi
%p A109905   od:
%p A109905   0 end proc:
%p A109905 map(f, [$1..100]); # _Robert Israel_, Feb 23 2018
%t A109905 Table[Max@Prepend[Select[Table[k (n - k) + 1, {k, n/2}], PrimeQ], 0], {n, 60}] (* _Ivan Neretin_, Feb 23 2018 *)
%o A109905 (PARI) { a(n) = forstep(k=n\2,1,-1,if(isprime(k*(n-k)+1),return(k*(n-k)+1)));return(0) } \\ _Max Alekseyev_, Oct 04 2005
%Y A109905 Cf. A109904, A026728.
%K A109905 nonn
%O A109905 1,2
%A A109905 _Amarnath Murthy_, Jul 15 2005
%E A109905 More terms from _Max Alekseyev_, Oct 04 2005