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.

A180131 Smallest k such that k*3^n is a sum of two successive primes.

This page as a plain text file.
%I A180131 #12 May 06 2021 21:20:06
%S A180131 5,4,2,6,2,10,20,26,22,10,16,8,8,72,24,8,18,6,2,6,2,10,20,20,22,20,52,
%T A180131 50,104,118,84,28,38,306,102,34,100,50,30,10,192,64,46,66,22,220,84,
%U A180131 28,176,88,30,10,8,152,292,98,82,124,160,206,106,106,160,128,78,26,110,80
%N A180131 Smallest k such that k*3^n is a sum of two successive primes.
%C A180131 If a(n) == 0 (mod 3), then a(n+1) = a(n)/3.
%C A180131 Records: 5, 6, 10, 20, 26, 72, 104, 118, 306, 320, 348, 572, 824, 828, 972, 1054, 1110, 1540, ..., .
%C A180131 Corresponding primes are twin primes for n = 0, 1, 10, 13, 14, 15, 22, 102, ..., .
%H A180131 Robert G. Wilson v, <a href="/A180131/b180131.txt">Table of n, a(n) for n = 0..700</a>
%t A180131 f[n_] := Block[{k = 1, j = 3^n/2}, While[ h = k*j; PrimeQ@h || NextPrime[h, -1] + NextPrime@h != 2 h, k++ ]; k]; Array[f, 80, 0]
%o A180131 (Python)
%o A180131 from sympy import isprime, nextprime, prevprime
%o A180131 def ok(n):
%o A180131   if n <= 5: return n == 5
%o A180131   return not isprime(n//2) and n == prevprime(n//2) + nextprime(n//2)
%o A180131 def a(n):
%o A180131   k, pow3 = 1, 3**n
%o A180131   while not ok(k*pow3): k += 1
%o A180131   return k
%o A180131 print([a(n) for n in range(68)]) # _Michael S. Branicky_, May 04 2021
%Y A180131 Cf. A180130, A180132, A180133, A180134, A179975, A180135, A180136, A180137, A180138.
%K A180131 nonn
%O A180131 0,1
%A A180131 _Zak Seidov_ & _Robert G. Wilson v_, Aug 15 2010