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.

A180130 Smallest k such that k*2^n is a sum of two successive primes.

This page as a plain text file.
%I A180130 #13 May 06 2021 03:21:31
%S A180130 5,4,2,1,7,4,2,1,9,15,8,4,2,1,25,19,11,12,6,3,10,5,35,33,52,26,13,28,
%T A180130 14,7,15,38,19,45,47,26,13,43,84,42,21,39,35,18,9,46,23,43,49,104,52,
%U A180130 26,13,48,24,12,6,3,21,36,18,9,15,15,9,42,21,23,67,62,31,64,32,16,8,4,2,1,45
%N A180130 Smallest k such that k*2^n is a sum of two successive primes.
%C A180130 If a(n) == 0 (mod 2), then a(n+1) = a(n)/2.
%C A180130 Records: 5, 7, 9, 15, 25, 35, 52, 84, 104, 146, 284, 330, 645, 660, 1020, 1677, 1701, 1747, 2247, 2991, ..., .
%C A180130 Corresponding primes are twin primes for n = 0, 1, 2, 3, 8, 17, 18, 19, 23, 43, 44, 64, 156, 189, 190, 210, 211, 212, 264, 265, 281, 282, 283, 388, 547, 725, 726, 727, ..., .
%H A180130 Robert G. Wilson v, <a href="/A180130/b180130.txt">Table of n, a(n) for n = 0..1000</a>
%t A180130 f[n_] := Block[{k = 1, j = 2^n/2}, While[ h = k*j; PrimeQ@h || NextPrime[h, -1] + NextPrime@h != 2 h, k++ ]; k]; Array[f, 79, 0]
%o A180130 (Python)
%o A180130 from sympy import isprime, nextprime, prevprime
%o A180130 def ok(n):
%o A180130   if n <= 5: return n == 5
%o A180130   return not isprime(n//2) and n == prevprime(n//2) + nextprime(n//2)
%o A180130 def a(n):
%o A180130   k, pow2 = 1, 2**n
%o A180130   while not ok(k*pow2): k += 1
%o A180130   return k
%o A180130 print([a(n) for n in range(79)]) # _Michael S. Branicky_, May 04 2021
%Y A180130 Cf. A180131, A180132, A180133, A180134, A179975, A180135, A180136, A180137, A180138.
%K A180130 nonn
%O A180130 0,1
%A A180130 _Zak Seidov_ & _Robert G. Wilson v_, Aug 15 2010