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 A239676 #26 May 22 2025 10:21:37 %S A239676 1,2,2,4,2,2,2,8,6,2,8,28,10,12,4,4,2,2,10,20,26,24,8,48,16,34,14,14, %T A239676 18,6,2,26,26,14,22,26,16,22,12,4,62,64,68,88,70,56,34,96,32,50,20,24, %U A239676 8,6,2,18,6,2,8,6,2,42,14,18,6,2,98,66,22,70,74,80,68,52 %N A239676 Least k such that k*3^n+1 is prime. %C A239676 All numbers in this sequence, except for a(0), are even. %H A239676 Marius A. Burtea, <a href="/A239676/b239676.txt">Table of n, a(n) for n = 0..1000</a> %e A239676 1*3^1+1 = 4 is not prime. 2*3^1+1 = 7 is prime. Thus, a(1) = 2. %e A239676 1*3^3+1 = 28 is not prime. 2*3^3+1 = 57 is not prime. 3*3^3+1 = 82 is not prime. 4*3^3+1 = 109 is prime. Thus, a(3) = 4. %t A239676 lk[n_]:=Module[{k=1,t=3^n},While[!PrimeQ[k*t+1],k++];k]; Array[lk,80,0] (* _Harvey P. Dale_, May 11 2025 *) %o A239676 (Python) %o A239676 import sympy %o A239676 from sympy import isprime %o A239676 def Pow3(n): %o A239676 for k in range(10**4): %o A239676 if isprime(k*(3**n)+1): %o A239676 return n %o A239676 n = 1 %o A239676 while n < 100: %o A239676 print(Pow3(n)) %o A239676 n += 1 %o A239676 (PARI) %o A239676 for(n=0, 100, k=0; while(!isprime(k*3^n+1), k++); print1(k, ", ")) \\ _Colin Barker_, Mar 24 2014 %o A239676 (Magma) sol:=[];m:=1; for n in [0..73] do k:=0; while not IsPrime(k*3^n+1) do k:=k+1; end while; sol[m]:=k; m:=m+1; end for; sol; // _Marius A. Burtea_, Jun 05 2019 %Y A239676 Cf. A003306 (where k=2), A035050 (k*2^n+1 is prime). %K A239676 nonn %O A239676 0,2 %A A239676 _Derek Orr_, Mar 23 2014