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.

A295639 Smallest k not divisible by 3 such that k*3^n + 1 is prime.

This page as a plain text file.
%I A295639 #24 Dec 27 2017 03:14:59
%S A295639 2,2,4,2,2,2,8,8,2,8,28,10,64,4,4,2,2,10,20,26,56,8,104,16,34,14,14,
%T A295639 20,26,2,26,26,14,22,26,16,22,50,4,62,64,68,88,70,56,34,146,32,50,20,
%U A295639 314,8,40,2,70,22,2,8,40,2,64,14,136,100,2
%N A295639 Smallest k not divisible by 3 such that k*3^n + 1 is prime.
%C A295639 The ratio (Sum_(n=1..t) a(n)) / (Sum_(n=1..t) n) tends to log(3) as t increases.
%C A295639 Differs from A239676 when A239676(n) is a multiple of 3. - _Michel Marcus_, Nov 25 2017
%H A295639 Pierre CAMI, <a href="/A295639/b295639.txt">Table of n, a(n) for n = 1..4000</a>
%p A295639 f:= proc(n) local i,j,k,t;
%p A295639   t:= 3^n;
%p A295639   for i from 0 do
%p A295639     for j in [2,4] do
%p A295639       if isprime((6*i+j)*t+1) then return 6*i+j fi
%p A295639   od od
%p A295639 end proc:
%p A295639 map(f, [$1..100]); # _Robert Israel_, Dec 14 2017
%t A295639 f[n_] := Block[{k = 2}, While[If[Mod[k, 3] == 0, k+=2]; ! PrimeQ[k*3^n + 1], k+=2]; k]; Array[f, 65] (* _Robert G. Wilson v_, Dec 12 2017 *)
%o A295639 (PARI) a(n) = {k = 1; while (!isprime(k*3^n+1), k++; if (! (k%3), k++)); k;} \\ _Michel Marcus_, Nov 25 2017
%Y A295639 Cf. A057778, A239676, A295640, A295641.
%K A295639 nonn
%O A295639 1,1
%A A295639 _Pierre CAMI_, Nov 25 2017