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.

A037201 Differences between consecutive primes (A001223) but with repeats omitted.

This page as a plain text file.
%I A037201 #39 Aug 27 2025 03:55:35
%S A037201 1,2,4,2,4,2,4,6,2,6,4,2,4,6,2,6,4,2,6,4,6,8,4,2,4,2,4,14,4,6,2,10,2,
%T A037201 6,4,6,2,10,2,4,2,12,4,2,4,6,2,10,6,2,6,4,2,10,14,4,2,4,14,6,10,2,4,6,
%U A037201 8,6,4,6,8,4,8,10,2,10,2,6,4,6,8,4
%N A037201 Differences between consecutive primes (A001223) but with repeats omitted.
%C A037201 Also the run-compression of the sequence of first differences of prime numbers, where we define the run-compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, we can remove all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has run-compression (1,2,1). - _Gus Wiseman_, Sep 16 2024
%H A037201 Reinhard Zumkeller, <a href="/A037201/b037201.txt">Table of n, a(n) for n = 1..10000</a>
%H A037201 <a href="/index/Pri#gaps">Index entries for primes, gaps between</a>
%F A037201 a(n>1) = 2*A373947(n-1). - _Gus Wiseman_, Sep 16 2024
%t A037201 Flatten[Split[Differences[Prime[Range[150]]]]/.{(k_)..}:>k] (* based on a program by _Harvey P. Dale_, Jun 21 2012 *)
%o A037201 (Haskell)
%o A037201 a037201 n = a037201_list !! (n-1)
%o A037201 a037201_list = f a001223_list where
%o A037201    f (x:xs@(x':_)) | x == x'   = f xs
%o A037201                    | otherwise = x : f xs
%o A037201 -- _Reinhard Zumkeller_, Feb 27 2012
%o A037201 (PARI) t=0;p=2;forprime(q=3,1e3,if(q-p!=t,print1(q-p", "));t=q-p;p=q) \\ _Charles R Greathouse IV_, Feb 27 2012
%Y A037201 This is the run-compression of A001223 = first differences of A000040.
%Y A037201 The repeats were at positions A064113 before being omitted.
%Y A037201 Adding up runs instead of compressing them gives A373822.
%Y A037201 The even terms halved are A373947.
%Y A037201 For prime-powers instead of prime numbers we have A376308.
%Y A037201 Positions of first appearances are A376520, sorted A376521.
%Y A037201 A003242 counts compressed compositions.
%Y A037201 A333254 lists run-lengths of differences between consecutive primes.
%Y A037201 A373948 encodes compression using compositions in standard order.
%Y A037201 Cf. A007921, A030173, A053289, A106356, A114901, A116608, A116861, A124767, A238130, A333755, A335406, A373954.
%K A037201 easy,nonn,nice,changed
%O A037201 1,2
%A A037201 _Naohiro Nomoto_
%E A037201 Offset corrected by _Reinhard Zumkeller_, Feb 27 2012