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.

A341765 Consider gaps between successive odd primes from 3 up to prime(n+2). Let k1 be number of gaps congruent to 2 (mod 6) and let k2 be number of gaps congruent to 4 (mod 6). Then a(n) = k1 - k2.

This page as a plain text file.
%I A341765 #57 May 10 2025 15:43:17
%S A341765 1,2,1,2,1,2,1,1,2,2,1,2,1,1,1,2,2,1,2,2,1,1,2,1,2,1,2,1,2,1,1,2,1,2,
%T A341765 2,2,1,1,1,2,1,2,1,2,2,2,1,2,1,1,2,1,1,1,1,2,2,1,2,1,2,1,2,1,2,2,1,2,
%U A341765 1,1,2,2,2,1,1,2,1,2,1,2,1,2,2,1,1,2,1,2,1,1,2,1,2,1,1,1,2,2,2,1,1,1,2,2
%N A341765 Consider gaps between successive odd primes from 3 up to prime(n+2). Let k1 be number of gaps congruent to 2 (mod 6) and let k2 be number of gaps congruent to 4 (mod 6). Then a(n) = k1 - k2.
%C A341765 Theorem A: for all n, a(n) belongs to the set: {1,2}, for proof see A342156.
%C A341765 The indices n for which numbers of 1's and 2's in this sequence are equal are 2, 4, 6, 10, 12, 20, 36, 46, 48 and no other up to n=10^6.
%F A341765 a(n) = 3 - A039701(n+2). - _Andrey Zabolotskiy_, Nov 04 2024
%e A341765 a(1)=1 because prime(2+1)-prime(2)=5-3=2 then the gap 2 is congruent to 2 mod 6, then k1=1 and k2=0 so k1 - k2 = 1.
%t A341765 k1 = 0; k2 = 0; cc = {}; Do[
%t A341765 gap = Prime[n + 1] - Prime[n];
%t A341765 If[Mod[gap/2, 3] == 1, k1 = k1 + 1,
%t A341765   If[Mod[gap/2, 3] == 2, k2 = k2 + 1]]; AppendTo[cc, k1 - k2];
%t A341765 If[k1 - k2 == 1, , If[k1 - k2 == 2, , Print[{n, k1 - k2}]]], {n, 2,
%t A341765   105}]; cc
%o A341765 (PARI) a(n) = {my(vp = vector(n+1, k, prime(k+1)), dp = vector(#vp-1, k, (vp[k+1] - vp[k])/2)); my(s=0); for (k=1, #dp, if ((dp[k]%3)==1, s++); if ((dp[k]%3) == 2, s--)); s;} \\ _Michel Marcus_, Feb 27 2021
%Y A341765 Cf. A000230, A001223, A028334, A321856, A341952, A342156, A039701.
%K A341765 nonn
%O A341765 1,2
%A A341765 _Artur Jasinski_, Feb 19 2021
%E A341765 Name edited by _Andrey Zabolotskiy_, Nov 04 2024