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.

Showing 1-10 of 16 results. Next

A238343 Triangle T(n,k) read by rows: T(n,k) is the number of compositions of n with k descents, n>=0, 0<=k<=n.

Original entry on oeis.org

1, 1, 0, 2, 0, 0, 3, 1, 0, 0, 5, 3, 0, 0, 0, 7, 9, 0, 0, 0, 0, 11, 19, 2, 0, 0, 0, 0, 15, 41, 8, 0, 0, 0, 0, 0, 22, 77, 29, 0, 0, 0, 0, 0, 0, 30, 142, 81, 3, 0, 0, 0, 0, 0, 0, 42, 247, 205, 18, 0, 0, 0, 0, 0, 0, 0, 56, 421, 469, 78, 0, 0, 0, 0, 0, 0, 0, 0, 77, 689, 1013, 264, 5, 0, 0, 0, 0, 0, 0, 0, 0, 101, 1113, 2059, 786, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 25 2014

Keywords

Comments

Counting ascents gives the same triangle.
For n > 0, also the number of compositions of n with k + 1 maximal weakly increasing runs. - Gus Wiseman, Mar 23 2020

Examples

			Triangle starts:
00:    1;
01:    1,    0;
02:    2,    0,    0;
03:    3,    1,    0,    0;
04:    5,    3,    0,    0,   0;
05:    7,    9,    0,    0,   0, 0;
06:   11,   19,    2,    0,   0, 0, 0;
07:   15,   41,    8,    0,   0, 0, 0, 0;
08:   22,   77,   29,    0,   0, 0, 0, 0, 0;
09:   30,  142,   81,    3,   0, 0, 0, 0, 0, 0;
10:   42,  247,  205,   18,   0, 0, 0, 0, 0, 0, 0;
11:   56,  421,  469,   78,   0, 0, 0, 0, 0, 0, 0, 0;
12:   77,  689, 1013,  264,   5, 0, 0, 0, 0, 0, 0, 0, 0;
13:  101, 1113, 2059,  786,  37, 0, 0, 0, 0, 0, 0, 0, 0, 0;
14:  135, 1750, 4021, 2097, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
15:  176, 2712, 7558, 5179, 751, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
...
From _Gus Wiseman_, Mar 23 2020: (Start)
Row n = 5 counts the following compositions:
  (5)          (3,2)
  (1,4)        (4,1)
  (2,3)        (1,3,1)
  (1,1,3)      (2,1,2)
  (1,2,2)      (2,2,1)
  (1,1,1,2)    (3,1,1)
  (1,1,1,1,1)  (1,1,2,1)
               (1,2,1,1)
               (2,1,1,1)
(End)
		

Crossrefs

T(3n,n) gives A000045(n+1).
T(3n+1,n) = A136376(n+1).
Row sums are A011782.
Compositions by length are A007318.
The version for co-runs or levels is A106356.
The case of partitions (instead of compositions) is A133121.
The version for runs is A238279.
The version without zeros is A238344.
The version for weak ascents is A333213.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, expand(
           add(b(n-j, j)*`if`(j (p-> seq(coeff(p, x, i), i=0..n))(b(n, 0)):
    seq(T(n), n=0..20);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n-j, j]*If[jJean-François Alcover, Jan 08 2015, translated from Maple *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],n==0||Length[Split[#,LessEqual]]==k+1&]],{n,0,9},{k,0,n}] (* Gus Wiseman, Mar 23 2020 *)

Formula

Sum_{k=0..n} k * T(n,k) = A045883(n-2) for n>=2.

A333254 Lengths of maximal runs in the sequence of prime gaps (A001223).

Original entry on oeis.org

1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Gus Wiseman, Mar 20 2020

Keywords

Comments

Prime gaps are differences between adjacent prime numbers.
Also lengths of maximal arithmetic progressions of consecutive primes.

Examples

			The prime gaps split into the following runs: (1), (2,2), (4), (2), (4), (2), (4), (6), (2), (6), (4), (2), (4), (6,6), (2), (6), (4), ...
		

Crossrefs

The version for A000002 is A000002. Similarly for A001462.
The unequal version is A333216.
The weakly decreasing version is A333212.
The weakly increasing version is A333215.
The strictly decreasing version is A333252.
The strictly increasing version is A333253.
Positions of first appearances are A335406.
The first term of the first length-n arithmetic progression of consecutive primes is A006560(n), with index A089180(n).
Prime gaps are A001223.
Positions of adjacent equal prime gaps are A064113.
Positions of adjacent unequal prime gaps are A333214.

Programs

  • Maple
    p:= 3: t:= 1: R:= NULL: s:= 1: count:= 0:
    for i from 2 while count < 100 do
      q:= nextprime(p);
      g:= q-p; p:= q;
      if g = t then s:= s+1
      else count:= count+1; R:= R, s; t:= g; s:= 1;
      fi
    od:
    R; # Robert Israel, Jan 06 2021
  • Mathematica
    Length/@Split[Differences[Array[Prime,100]],#1==#2&]//Most

Formula

Partial sums are A333214.

A258025 Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) > 0.

Original entry on oeis.org

1, 3, 5, 7, 8, 10, 13, 14, 17, 20, 22, 23, 26, 28, 29, 31, 33, 35, 38, 41, 43, 45, 49, 50, 52, 57, 60, 61, 64, 65, 67, 69, 70, 71, 75, 76, 78, 79, 81, 83, 85, 86, 89, 90, 93, 95, 96, 98, 100, 104, 105, 109, 113, 116, 117, 120, 122, 123, 124, 126, 131, 134
Offset: 1

Views

Author

Clark Kimberling, Jun 02 2015

Keywords

Examples

			5 - 2*3 + 2 = 1, so a(1) = 5.
		

Crossrefs

Partition of the positive integers: A064113, A258025, A258026;
Corresponding partition of the primes: A063535, A063535, A147812.
Adjacent terms differing by 1 correspond to weak prime quartets A054819.
The version for the Kolakoski sequence is A156243.
The version for strict descents is A258026.
The version for weak ascents is A333230.
The version for weak descents is A333231.
First differences are A333212 (if the first term is 0).
Prime gaps are A001223.
Positions of adjacent equal prime gaps are A064113.
Weakly decreasing runs of compositions in standard order are A124765.
A triangle counting compositions by strict ascents is A238343.
Positions of adjacent unequal prime gaps are A333214.
Lengths of maximal anti-runs of prime gaps are A333216.

Programs

  • Mathematica
    u = Table[Sign[Prime[n+2] - 2 Prime[n+1] + Prime[n]], {n, 3, 200}];
    Flatten[Position[u, 0]]   (* A064113 *)
    Flatten[Position[u, 1]]   (* A258025 *)
    Flatten[Position[u, -1]]  (* A258026 *)
    Accumulate[Length/@Split[Differences[Array[Prime,100]],#1>=#2&]]//Most (* Gus Wiseman, Mar 25 2020 *)
    Position[Partition[Prime[Range[150]],3,1],?(#[[3]]-2#[[2]]+#[[1]]> 0&),1,Heads->False]//Flatten (* _Harvey P. Dale, Dec 25 2021 *)
  • PARI
    isok(k) = prime(k+2) - 2*prime(k+1) + prime(k) > 0; \\ Michel Marcus, Jun 03 2015
    
  • PARI
    is(n,p=prime(n))=my(q=nextprime(p+1),r=nextprime(q+1)); p + r > 2*q
    v=List(); n=0; forprime(p=2,1e4, if(is(n++,p), listput(v,n))); v \\ Charles R Greathouse IV, Jun 03 2015
    
  • Python
    from itertools import count, islice
    from sympy import prime, nextprime
    def A258025_gen(startvalue=1): # generator of terms >= startvalue
        c = max(startvalue,1)
        p = prime(c)
        q = nextprime(p)
        r = nextprime(q)
        for k in count(c):
            if p+r>(q<<1):
                yield k
            p, q, r = q, r, nextprime(r)
    A258025_list = list(islice(A258025_gen(),20)) # Chai Wah Wu, Feb 27 2024

A258026 Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) < 0.

Original entry on oeis.org

4, 6, 9, 11, 12, 16, 18, 19, 21, 24, 25, 27, 30, 32, 34, 37, 40, 42, 44, 47, 48, 51, 53, 56, 58, 59, 62, 63, 66, 68, 72, 74, 77, 80, 82, 84, 87, 88, 91, 92, 94, 97, 99, 101, 103, 106, 108, 111, 112, 114, 115, 119, 121, 125, 127, 128, 130, 132, 133, 135, 137
Offset: 1

Views

Author

Clark Kimberling, Jun 05 2015

Keywords

Comments

Positions of strict descents in the sequence of differences between primes. Partial sums of A333215. - Gus Wiseman, Mar 24 2020

Examples

			The prime gaps split into the following maximal weakly increasing subsequences: (1,2,2,4), (2,4), (2,4,6), (2,6), (4), (2,4,6,6), (2,6), (4), (2,6), (4,6,8), (4), (2,4), (2,4,14), ... Then a(n) is the n-th partial sum of the lengths of these subsequences. - _Gus Wiseman_, Mar 24 2020
		

Crossrefs

Partition of the positive integers: A064113, A258025, A258026;
Corresponding partition of the primes: A063535, A063535, A147812.
Adjacent terms differing by 1 correspond to strong prime quartets A054804.
The version for the Kolakoski sequence is A156242.
First differences are A333215 (if the first term is 0).
The version for strict ascents is A258025.
The version for weak ascents is A333230.
The version for weak descents is A333231.
Prime gaps are A001223.
Positions of adjacent equal prime gaps are A064113.
Weakly increasing runs of compositions in standard order are A124766.
Strictly decreasing runs of compositions in standard order are A124769.

Programs

  • Mathematica
    u = Table[Sign[Prime[n+2] - 2 Prime[n+1] + Prime[n]], {n, 1, 200}];
    Flatten[Position[u, 0]]   (* A064113 *)
    Flatten[Position[u, 1]]   (* A258025 *)
    Flatten[Position[u, -1]]  (* A258026 *)
    Accumulate[Length/@Split[Differences[Array[Prime,100]],LessEqual]]//Most (* Gus Wiseman, Mar 24 2020 *)
  • Python
    from itertools import count, islice
    from sympy import prime, nextprime
    def A258026_gen(startvalue=1): # generator of terms >= startvalue
        c = max(startvalue,1)
        p = prime(c)
        q = nextprime(p)
        r = nextprime(q)
        for k in count(c):
            if p+r<(q<<1):
                yield k
            p, q, r = q, r, nextprime(r)
    A258026_list = list(islice(A258026_gen(),20)) # Chai Wah Wu, Feb 27 2024

A054804 First term of strong prime quartets: prime(m+1)-prime(m) > prime(m+2)-prime(m+1) > prime(m+3)-prime(m+2).

Original entry on oeis.org

31, 61, 89, 211, 271, 293, 449, 467, 607, 619, 709, 743, 839, 863, 919, 1069, 1291, 1409, 1439, 1459, 1531, 1637, 1657, 1669, 1723, 1759, 1777, 1831, 1847, 1861, 1979, 1987, 2039, 2131, 2311, 2357, 2371, 2447, 2459, 2477, 2503, 2521, 2557, 2593, 2633
Offset: 1

Views

Author

Henry Bottomley, Apr 10 2000

Keywords

Comments

Primes preceding the first member of pairs of consecutive primes in A051634 ("strong primes"), see example. (A051634 lists the middle member of the triplets, here we list the first member of the quadruplets.) - M. F. Hasler, Oct 27 2018, corrected thanks to Gus Wiseman, Jun 01 2020.

Examples

			The first 10 strictly decreasing prime gap quartets:
   31  37  41  43
   61  67  71  73
   89  97 101 103
  211 223 227 229
  271 277 281 283
  293 307 311 313
  449 457 461 463
  467 479 487 491
  607 613 617 619
  619 631 641 643
For example, the primes (211,223,227,229) have differences (12,4,2), which are strictly decreasing, so 211 is in the sequence.
The second and third term of each quadruplet are consecutive terms in A051634: this is a characteristic property of this sequence. - _M. F. Hasler_, Jun 01 2020
		

Crossrefs

Prime gaps are A001223.
Second prime gaps are A036263.
All of the following use prime indices rather than the primes themselves:
- Strictly decreasing prime gap quartets are A335278.
- Strictly increasing prime gap quartets are A335277.
- Equal prime gap quartets are A090832.
- Weakly increasing prime gap quartets are A333383.
- Weakly decreasing prime gap quartets are A333488.
- Unequal prime gap quartets are A333490.
- Partially unequal prime gap quartets are A333491.
- Adjacent equal prime gaps are A064113.
- Strict ascents in prime gaps are A258025.
- Strict descents in prime gaps are A258026.
- Adjacent unequal prime gaps are A333214.
- Weak ascents in prime gaps are A333230.
- Weak descents in prime gaps are A333231.
Maximal weakly increasing intervals of prime gaps are A333215.
Maximal strictly decreasing intervals of prime gaps are A333252.

Programs

  • Maple
    primes:= select(isprime,[seq(i,i=3..10000,2)]):
    L:=  primes[2..-1]-primes[1..-2]:
    primes[select(t -> L[t+2] < L[t+1] and L[t+1] < L[t], [$1..nops(L)-2])]; # Robert Israel, Jun 28 2018
  • Mathematica
    ReplaceList[Array[Prime,100],{_,x_,y_,z_,t_,_}/;y-x>z-y>t-z:>x] (* Gus Wiseman, May 31 2020 *)
    Select[Partition[Prime[Range[400]],4,1],Max[Differences[#,2]]<0&][[All,1]] (* Harvey P. Dale, Jan 12 2023 *)

Formula

a(n) = prime(A335278(n)). - Gus Wiseman, May 31 2020

A333230 Positions of weak ascents in the sequence of differences between primes.

Original entry on oeis.org

1, 2, 3, 5, 7, 8, 10, 13, 14, 15, 17, 20, 22, 23, 26, 28, 29, 31, 33, 35, 36, 38, 39, 41, 43, 45, 46, 49, 50, 52, 54, 55, 57, 60, 61, 64, 65, 67, 69, 70, 71, 73, 75, 76, 78, 79, 81, 83, 85, 86, 89, 90, 93, 95, 96, 98, 100, 102, 104, 105, 107, 109, 110, 113
Offset: 1

Views

Author

Gus Wiseman, Mar 18 2020

Keywords

Comments

Partial sums of A333252.

Examples

			The prime gaps split into the following strictly decreasing subsequences: (1), (2), (2), (4,2), (4,2), (4), (6,2), (6,4,2), (4), (6), (6,2), (6,4,2), (6,4), (6), (8,4,2), ...
		

Crossrefs

The version for the Kolakoski sequence is A022297.
The version for equal differences is A064113.
The version for strict ascents is A258025.
The version for strict descents is A258026.
The version for distinct differences is A333214.
The version for weak descents is A333231.
First differences are A333252 (if the first term is 0).
Prime gaps are A001223.
Weakly decreasing runs of standard compositions are counted by A124765.
Weakly increasing runs of standard compositions are counted by A124766.
Strictly increasing runs of standard compositions are counted by A124768.
Strictly decreasing runs of standard compositions are counted by A124769.
Runs of prime gaps with nonzero differences are A333216.

Programs

  • Mathematica
    Accumulate[Length/@Split[Differences[Array[Prime,100]],#1>#2&]]//Most
    - or -
    Select[Range[100],Prime[#+1]-Prime[#]<=Prime[#+2]-Prime[#+1]&]

Formula

Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) >= 0.

A333216 Lengths of maximal subsequences without adjacent equal terms in the sequence of prime gaps.

Original entry on oeis.org

2, 13, 21, 3, 7, 8, 1, 18, 29, 5, 3, 8, 11, 31, 4, 20, 3, 7, 5, 19, 21, 32, 1, 19, 48, 19, 29, 32, 7, 38, 1, 43, 12, 33, 46, 6, 16, 8, 4, 34, 15, 1, 19, 7, 1, 23, 28, 30, 22, 8, 1, 7, 1, 52, 14, 56, 10, 26, 2, 30, 65, 5, 71, 12, 44, 39, 37, 6, 19, 47, 11, 10
Offset: 1

Views

Author

Gus Wiseman, Mar 15 2020

Keywords

Comments

Prime gaps are differences between adjacent prime numbers.
Essentially the same as A145024. - R. J. Mathar, Mar 16 2020

Examples

			The prime gaps split into the following subsequences without adjacent equal terms: (1,2), (2,4,2,4,2,4,6,2,6,4,2,4,6), (6,2,6,4,2,6,4,6,8,4,2,4,2,4,14,4,6,2,10,2,6), (6,4,6), (6,2,10,2,4,2,12), (12,4,2,4,6,2,10,6), ...
		

Crossrefs

First differences of A064113.
The version for the Kolakoski sequence is A306323.
The weakly decreasing version is A333212.
The weakly increasing version is A333215.
The strictly decreasing version is A333252.
The strictly increasing version is A333253.
The equal version is A333254.

Programs

  • Mathematica
    Length/@Split[Differences[Array[Prime,100]],UnsameQ]//Most

Formula

Ones correspond to balanced prime quartets (A054800), so the sum of terms up to but not including the n-th one is A000720(A054800(n - 1)) = A090832(n).

A376855 Position of first 0 in the n-th differences of the noncomposite numbers (A008578), or 0 if it does not appear.

Original entry on oeis.org

0, 0, 1, 8, 70, 14, 48, 59, 10, 44, 3554, 101, 7020, 14083, 68098, 14527, 149678, 2698, 481055, 979720, 631895, 29812, 25340979, 50574255, 7510844, 210829338, 67248862, 224076287, 910615648, 931510270, 452499645, 2880203723, 396680866, 57954439971, 77572822441, 35394938649
Offset: 0

Views

Author

Gus Wiseman, Oct 15 2024

Keywords

Examples

			The third differences of the noncomposite numbers begin: 1, -1, 2, -4, 4, -4, 4, 0, -6, 8, ... so a(3) = 8.
		

Crossrefs

For firsts instead of positions of zeros we have A030016, modern A007442.
These are the first zero-positions in A376682, modern A376678.
For row-sums instead of zero-positions we have A376683, modern A140119.
For absolute row-sums we have A376684, modern A376681.
For composite instead of noncomposite we have A377037.
For squarefree instead of noncomposite we have A377042, nonsquarefree A377050.
For prime-power instead of noncomposite we have A377055.
A000040 lists the modern primes, differences A001223, seconds A036263.
A008578 lists the noncomposite numbers, first differences A075526.

Programs

  • Mathematica
    nn=10000;
    u=Table[Differences[Select[Range[nn],#==1||PrimeQ[#]&],k],{k,2,16}];
    mnrm[s_]:=If[Min@@s==1,mnrm[DeleteCases[s-1,0]]+1,0];
    m=Table[Position[u[[k]],0][[1,1]],{k,mnrm[Union[First/@Position[u,0]]]}]

Extensions

a(16)-a(21) from Alois P. Heinz, Oct 18 2024
a(22)-a(35) from Lucas A. Brown, Nov 03 2024

A333212 Lengths of maximal weakly decreasing subsequences in the sequence of prime gaps (A001223).

Original entry on oeis.org

1, 2, 2, 2, 1, 2, 3, 1, 3, 3, 2, 1, 3, 2, 1, 2, 2, 2, 3, 3, 2, 2, 4, 1, 2, 5, 3, 1, 3, 1, 2, 2, 1, 1, 4, 1, 2, 1, 2, 2, 2, 1, 3, 1, 3, 2, 1, 2, 2, 4, 1, 4, 4, 3, 1, 3, 2, 1, 1, 2, 5, 3, 2, 2, 2, 2, 2, 1, 3, 1, 3, 1, 2, 1, 3, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 3
Offset: 1

Views

Author

Gus Wiseman, Mar 14 2020

Keywords

Comments

Prime gaps are differences between adjacent prime numbers.

Examples

			The prime gaps split into the following weakly decreasing subsequences: (1), (2,2), (4,2), (4,2), (4), (6,2), (6,4,2), (4), (6,6,2), (6,4,2), (6,4), (6), ...
		

Crossrefs

First differences of A258025 (with zero prepended).
The version for the Kolakoski sequence is A332273.
The weakly increasing version is A333215.
The unequal version is A333216.
The strictly decreasing version is A333252.
The strictly increasing version is A333253.
The equal version is A333254.
Prime gaps are A001223.
Positions of adjacent equal differences are A064113.
Weakly decreasing runs of compositions in standard order are A124765.
Positions of strict ascents in the sequence of prime gaps are A258025.

Programs

  • Mathematica
    Length/@Split[Differences[Array[Prime,100]],#1>=#2&]//Most

Formula

Ones correspond to weak prime quartets A054819, so the sum of terms up to but not including the n-th one is A000720(A054819(n - 1)).

A333253 Lengths of maximal strictly increasing subsequences in the sequence of prime gaps (A001223).

Original entry on oeis.org

2, 2, 2, 3, 2, 1, 3, 1, 2, 1, 2, 3, 1, 2, 3, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 1, 3, 2, 1, 1, 1, 2, 1, 3, 1, 3, 2, 4, 1, 1, 3, 3, 2, 2, 3, 1, 3, 1, 2, 3, 2, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 4, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 3, 1, 3, 1, 3, 3, 1, 2, 2, 2
Offset: 1

Views

Author

Gus Wiseman, Mar 18 2020

Keywords

Comments

Prime gaps are differences between adjacent prime numbers.

Examples

			The prime gaps split into the following strictly increasing subsequences: (1,2), (2,4), (2,4), (2,4,6), (2,6), (4), (2,4,6), (6), (2,6), (4), (2,6), (4,6,8), (4), (2,4), (2,4,14), ...
		

Crossrefs

The weakly decreasing version is A333212.
The weakly increasing version is A333215.
The unequal version is A333216.
First differences of A333231 (if its first term is 0).
The strictly decreasing version is A333252.
The equal version is A333254.
Prime gaps are A001223.
Strictly increasing runs of compositions in standard order are A124768.
Positions of strict ascents in the sequence of prime gaps are A258025.

Programs

  • Mathematica
    Length/@Split[Differences[Array[Prime,100]],#1<#2&]//Most

Formula

Partial sums are A333231. The partial sum up to but not including the n-th one is A333382(n).
Showing 1-10 of 16 results. Next