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.

A376891 Numbers k such that the sum of the first k lesser of twin primes is a lesser of twin prime.

This page as a plain text file.
%I A376891 #19 Jun 24 2025 12:24:05
%S A376891 1,23,143,251,281,305,341,455,605,761,1349,1613,2765,2903,2981,3623,
%T A376891 3725,3923,4049,4133,4745,5207,5303,5489,5765,6515,6611,7793,7835,
%U A376891 8153,8237,10427,10697,11261,11447,11627,11729,12401,12701,13871,14327,15359,15683
%N A376891 Numbers k such that the sum of the first k lesser of twin primes is a lesser of twin prime.
%H A376891 Robert Israel, <a href="/A376891/b376891.txt">Table of n, a(n) for n = 1..10000</a>
%H A376891 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TwinPrimes.html">Twin Primes</a>.
%p A376891 K:= 1: count:= 1: s:= 3: k:= 1:
%p A376891 for p from 5 by 6 do
%p A376891   if isprime(p) and isprime(p+2) then
%p A376891     k:= k+1;
%p A376891     s:= s+p;
%p A376891     if s mod 6 = 5 and isprime(s) and isprime(s+2) then
%p A376891       count:= count+1; K:= K,k;
%p A376891       if count = 100 then break fi;
%p A376891 fi fi od:
%p A376891 K; # _Robert Israel_, Oct 08 2024
%t A376891 Position[Accumulate[Select[Partition[Prime[Range[200000]],2,1],#[[2]]-#[[1]]==2&][[;;,1]]],_?(AllTrue[#+{0,2},PrimeQ]&)]//Quiet//Flatten (* _Harvey P. Dale_, Jun 24 2025 *)
%o A376891 (PARI) lista(nn) = my(v=select(p->isprime(p+2), primes(nn)), s = vector(#v)); s[1] = v[1]; for (i=2, #v, s[i] = s[i-1]+v[i]); Vec(select(x->(isprime(x) && isprime(x+2)), s, 1)); \\ _Michel Marcus_, Oct 10 2024
%Y A376891 Cf. A001359, A013916, A071149, A086167, A089228, A376892.
%K A376891 nonn
%O A376891 1,2
%A A376891 _Ilya Gutkovskiy_, Oct 08 2024