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.

A346149 a(n) is the least integer k > 1 such that n^k + n + 1 is prime, or 0 if there is no such k.

This page as a plain text file.
%I A346149 #13 Jul 09 2021 22:58:09
%S A346149 2,2,2,0,2,2,0,2,3,0,4,2,0,2,2,0,2,3,0,2,2,0,9,2,0,4,2,0,3,3,0,3,2,0,
%T A346149 15,4,0,2,3,0,2,3,0,3,6,0,4,3,0,2,9,0,3,2,0,3,2,0,2,3,0,2,73,0,12,2,0,
%U A346149 595,2,0,2,4,0,3,2,0,2,2,0,2,7,0,3,30,0,21,3,0,2,2,0,7,67,0,3
%N A346149 a(n) is the least integer k > 1 such that n^k + n + 1 is prime, or 0 if there is no such k.
%C A346149 a(n) = 0 if n == 1 (mod 3) and n > 1.
%C A346149 Conjecture: a(n) > 0 otherwise.
%H A346149 Robert Israel, <a href="/A346149/b346149.txt">Table of n, a(n) for n = 1..212</a>
%e A346149 a(9) = 3 because 9^3 + 9 + 1 = 739 is prime while 9^2+9+1 is not.
%p A346149 f:= proc(n) local i;
%p A346149 if n mod 3 = 1 then return 0 fi;
%p A346149 for i from 2 do if isprime(n^i+n+1) then return i fi od:
%p A346149 end proc:
%p A346149 f(1):= 2:
%p A346149 map(f, [$1..100]);
%o A346149 (PARI) a(n) = if ((n>1) && ((n%3)==1), 0, my(k=2); while (!isprime(n^k+n+1), k++); k); \\ _Michel Marcus_, Jul 07 2021
%o A346149 (Python)
%o A346149 from sympy import isprime
%o A346149 def a(n):
%o A346149     if n > 1 and n%3 == 1: return 0
%o A346149     k = 2
%o A346149     while not isprime(n**k + n + 1): k += 1
%o A346149     return k
%o A346149 print([a(n) for n in range(1, 96)]) # _Michael S. Branicky_, Jul 08 2021
%K A346149 nonn
%O A346149 1,1
%A A346149 _J. M. Bergot_ and _Robert Israel_, Jul 07 2021