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.

A290585 a(n) is the largest number <= n such that 1 + a(1)*a(2)*...*a(n) is prime.

This page as a plain text file.
%I A290585 #39 May 02 2021 14:59:33
%S A290585 1,2,3,3,4,6,6,4,7,7,3,10,13,12,10,9,13,14,15,16,13,21,22,11,25,26,27,
%T A290585 17,29,23,7,11,30,24,34,1,1,1,1,1,1,1,1,1,45,39,23,48,32,25,44,49,53,
%U A290585 31,1,1,1,1,59,46,53,55,62,40,62,59,46,41,9,62,59,64,1,1,1,1,1,1,1,80,57,78,80,1,85
%N A290585 a(n) is the largest number <= n such that 1 + a(1)*a(2)*...*a(n) is prime.
%C A290585 a(n) = n for n = 1, 2, 3, 6, 13, 25, 26, 27, 29, 45, 48, 53, 59, 80, 85, ...
%C A290585 If a(n) = 1, then the next entry > 1 is a(m) = m for the least m > n such that 1 + m * Product_{j=1..n-1} a_j is prime. By Dirichlet's theorem such m exists. - _Robert Israel_, Aug 07 2017
%H A290585 Iain Fox, <a href="/A290585/b290585.txt">Table of n, a(n) for n = 1..2000</a>
%p A290585 A[1]:= 1: P:= 1:
%p A290585 for n from 2 to 200 do
%p A290585   for k from n to 0 by -1 do
%p A290585     if isprime(1+k*P) then
%p A290585       A[n]:= k;
%p A290585       P:= P*k;
%p A290585       break
%p A290585     fi
%p A290585   od;
%p A290585 od:
%p A290585 seq(A[i],i=1..200); # _Robert Israel_, Aug 07 2017
%t A290585 p = 1; Table[t = SelectFirst[Range[n, 1, -1], PrimeQ[1 + p #] &]; p *= t; t, {n, 85}] (* _Giovanni Resta_, Aug 08 2017 *)
%o A290585 (Python)
%o A290585 from sympy import isprime
%o A290585 A=[0, 1]
%o A290585 p=1
%o A290585 for n in range(2, 201):
%o A290585     for k in range(n, -1, -1):
%o A290585         if isprime(1 + k*p):
%o A290585             A.append(k)
%o A290585             p*=k
%o A290585             break
%o A290585 print(A[1:]) # _Indranil Ghosh_, Aug 10 2017
%o A290585 (PARI) first(n) = { my(i = 1, res = vector(n)); res[1]=1; for(x=2, n, forstep(k=x, 0, -1, if(ispseudoprime(1+k*i), res[x]=k; i*=k; break()))); res; } \\ _Iain Fox_, Nov 15 2017
%Y A290585 Cf. A036012, A290639.
%K A290585 nonn
%O A290585 1,2
%A A290585 _Thomas Ordowski_, Aug 07 2017
%E A290585 More terms from _Robert Israel_, Aug 07 2017