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 42 results. Next

A376343 Positions of twos in the run-compressed (A037201) first differences (A001223) of the primes (A000040).

Original entry on oeis.org

2, 4, 6, 9, 12, 15, 18, 24, 26, 31, 33, 37, 39, 41, 44, 47, 50, 53, 57, 62, 73, 75, 81, 90, 95, 99, 102, 105, 108, 127, 129, 131, 135, 139, 156, 158, 161, 163, 167, 173, 182, 187, 190, 193, 196, 205, 210, 214, 216, 232, 235, 241, 244, 247, 254, 263, 265, 270
Offset: 1

Views

Author

Gus Wiseman, Sep 26 2024

Keywords

Comments

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).

Examples

			The sequence of prime numbers (A000040) is:
  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, ...
with first differences (A001223):
  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, ...
with run-compression (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, ...
with twos at (A376343):
  2, 4, 6, 9, 12, 15, 18, 24, 26, 31, 33, 37, 39, 41, 44, 47, 50, 53, 57, 62, 73, ...
		

Crossrefs

Positions of 2's in A037201.
The repeats were at positions A064113 before being omitted.
A variation for squarefree numbers is A376342.
A000040 lists the prime numbers, differences A001223.
A000961 and A246655 list prime-powers, differences A057820.
A005117 lists squarefree numbers, differences A076259 (ones A375927).
A013929 lists nonsquarefree numbers, differences A078147.
A333254 lists run-lengths of differences between consecutive primes.

Programs

  • Mathematica
    Join@@Position[First/@Split[Differences[Select[Range[100],PrimeQ]]],2]

Formula

For just the odd primes we have a(n) - 1.

A376521 Sorted positions of first appearances in the run-compression (A037201) of the first differences (A001223) of the prime numbers (A000040).

Original entry on oeis.org

1, 2, 3, 8, 22, 28, 32, 42, 91, 141, 172, 198, 242, 259, 341, 400, 556, 692, 1119, 1737, 1779, 2072, 2101, 2913, 3126, 3204, 3246, 3457, 3598, 4294, 4383, 7596, 7651, 8284, 11986, 13729, 14220, 15101, 16273, 18217, 22303, 29523, 30243, 32236, 32808, 32820
Offset: 1

Views

Author

Gus Wiseman, Sep 26 2024

Keywords

Comments

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).

Examples

			The sequence of prime numbers (A000040) is:
  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, ...
with first differences (A001223):
  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, ...
with run-compression (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, ...
with first appearances at (A376521):
  1, 2, 3, 8, 22, 28, 32, 42, 91, 141, 172, 198, 242, 259, 341, 400, 556, 692, 1119, ...
		

Crossrefs

These are the sorted positions of first appearances in A037201.
For positions of twos instead of first appearances we have A376343.
The unsorted version is A376520.
A000040 lists the prime numbers, differences A001223.
A003242 counts compressed compositions, ranks A333489.
A333254 lists run-lengths of differences between consecutive primes.
A373948 encodes compression using compositions in standard order.

Programs

  • Mathematica
    q=First/@Split[Differences[Select[Range[1000],PrimeQ]]];
    Select[Range[Length[q]],!MemberQ[Take[q,#-1],q[[#]]]&]

A376520 Position of first appearance of 2n in the run-compression (A037201) of the first differences (A001223) of the prime numbers (A000040).

Original entry on oeis.org

2, 3, 8, 22, 32, 42, 28, 259, 91, 141, 172, 242, 341, 400, 556, 692, 198, 1119, 3126, 2072, 1779, 1737, 7596, 2913, 3246, 2101, 3598, 7651, 4383, 4294, 3457, 8284, 14220, 11986, 15101, 3204, 32808, 18217, 16273, 42990, 22303, 37037, 13729, 43117, 32820, 70501
Offset: 1

Views

Author

Gus Wiseman, Sep 26 2024

Keywords

Comments

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).

Examples

			The sequence of prime numbers (A000040) is:
  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, ...
with first differences (A001223):
  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, ...
with run-compression (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, ...
with first appearance of 2n at (A376520):
  2, 3, 8, 22, 32, 42, 28, 259, 91, 141, 172, 242, 341, 400, 556, 692, 198, 1119, ...
		

Crossrefs

This is the position of first appearance of 2n in A037201.
For positions of twos instead of first appearances we have A376343.
The sorted version is A376521.
A000040 lists the prime numbers, differences A001223.
A000961 and A246655 list prime-powers, differences A057820.
A003242 counts compressed compositions, ranks A333489.
A005117 lists squarefree numbers, differences A076259 (ones A375927).
A013929 lists nonsquarefree numbers, differences A078147.
A116861 counts partitions by compressed sum, compositions A373949.
A116608 counts partitions by compressed length, compositions A333755.
A274174 counts contiguous compositions, ranks A374249.
A333254 lists run-lengths of differences between consecutive primes.
A373948 encodes compression using compositions in standard order.

Programs

  • Mathematica
    mnrm[s_]:=If[Min@@s==1,mnrm[DeleteCases[s-1,0]]+1,0];
    q=First/@Split[Differences[Select[Range[10000],PrimeQ]]];
    Table[Position[q,2k][[1,1]],{k,mnrm[Rest[q]/2]}]

A037203 Number of terms by which A001223 lags behind A037201.

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A037204.

A001223 Prime gaps: differences between consecutive primes.

Original entry on oeis.org

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, 6, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6, 4, 6, 8, 4, 2, 4, 12, 8, 4, 8, 4, 6, 12
Offset: 1

Views

Author

Keywords

Comments

There is a unique decomposition of the primes: provided the weight A117078(n) is > 0, we have prime(n) = weight * level + gap, or A000040(n) = A117078(n) * A117563(n) + a(n). - Rémi Eismann, Feb 14 2008
Let rho(m) = A179196(m), for any n, let m be an integer such that p_(rho(m)) <= p_n and p_(n+1) <= p_(rho(m+1)), then rho(m) <= n < n + 1 <= rho(m + 1), therefore a(n) = p_(n+1) - p_n <= p_rho(m+1) - p_rho(m) = A182873(m). For all rho(m) = A179196(m), a(rho(m)) < A165959(m). - John W. Nicholson, Dec 14 2011
A solution (modular square root) of x^2 == A001248(n) (mod A000040(n+1)). - L. Edson Jeffery, Oct 01 2014
There exists a constant C such that for n -> infinity, Cramer conjecture a(n) < C log^2 prime(n) is equivalent to (log prime(n+1)/log prime(n))^n < e^C. - Thomas Ordowski, Oct 11 2014
a(n) = A008347(n+1) - A008347(n-1). - Reinhard Zumkeller, Feb 09 2015
Yitang Zhang proved lim inf_{n -> infinity} a(n) is finite. - Robert Israel, Feb 12 2015
lim sup_{n -> infinity} a(n)/log^2 prime(n) = C <==> lim sup_{n -> infinity}(log prime(n+1)/log prime(n))^n = e^C. - Thomas Ordowski, Mar 09 2015
a(A038664(n)) = 2*n and a(m) != 2*n for m < A038664(n). - Reinhard Zumkeller, Aug 23 2015
If j and k are positive integers then there are no two consecutive primes gaps of the form 2+6j and 2+6k (A016933) or 4+6j and 4+6k (A016957). - Andres Cicuttin, Jul 14 2016
Conjecture: For any positive numbers x and y, there is an index k such that x/y = a(k)/a(k+1). - Andres Cicuttin, Sep 23 2018
Conjecture: For any three positive numbers x, y and j, there is an index k such that x/y = a(k)/a(k+j). - Andres Cicuttin, Sep 29 2018
Conjecture: For any three positive numbers x, y and j, there are infinitely many indices k such that x/y = a(k)/a(k+j). - Andres Cicuttin, Sep 29 2018
Row m of A174349 lists all indices n for which a(n) = 2m. - M. F. Hasler, Oct 26 2018
Since (6a, 6b) is an admissible pattern of gaps for any integers a, b > 0 (and also if other multiples of 6 are inserted in between), the above conjecture follows from the prime k-tuple conjecture which states that any admissible pattern occurs infinitely often (see, e.g., the Caldwell link). This also means that any subsequence a(n .. n+m) with n > 2 (as to exclude the untypical primes 2 and 3) should occur infinitely many times at other starting points n'. - M. F. Hasler, Oct 26 2018
Conjecture: Defining b(n,j,k) as the number of pairs of prime gaps {a(i),a(i+j)} such that i < n, j > 0, and a(i)/a(i+j) = k with k > 0, then
lim_{n -> oo} b(n,j,k)/b(n,j,1/k) = 1, for any j > 0 and k > 0, and
lim_{n -> oo} b(n,j,k1)/b(n,j,k2) = C with C = C(j,k1,k2) > 0. - Andres Cicuttin, Sep 01 2019

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 870.
  • GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 92.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 186-192.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000040 (primes), A001248 (primes squared), A000720, A037201, A007921, A030173, A036263-A036274, A167770, A008347.
Second difference is A036263, first occurrence is A000230.
For records see A005250, A005669.
Sequences related to the differences between successive primes: A001223 (Delta(p)), A028334, A080378, A104120, A330556-A330561.

Programs

  • Haskell
    a001223 n = a001223_list !! (n-1)
    a001223_list = zipWith (-) (tail a000040_list) a000040_list
    -- Reinhard Zumkeller, Oct 29 2011
    
  • Magma
    [(NthPrime(n+1) - NthPrime(n)): n in [1..100]]; // Vincenzo Librandi, Apr 02 2011
    
  • Maple
    with(numtheory): for n from 1 to 500 do printf(`%d,`,ithprime(n+1) - ithprime(n)) od:
  • Mathematica
    Differences[Prime[Range[100]]] (* Harvey P. Dale, May 15 2011 *)
  • PARI
    diff(v)=vector(#v-1,i,v[i+1]-v[i]);
    diff(primes(100)) \\ Charles R Greathouse IV, Feb 11 2011
    
  • PARI
    forprime(p=1, 1e3, print1(nextprime(p+1)-p, ", ")) \\ Felix Fröhlich, Sep 06 2014
    
  • Python
    from sympy import prime
    def A001223(n): return prime(n+1)-prime(n) # Chai Wah Wu, Jul 07 2022
  • Sage
    differences(prime_range(1000)) # Joerg Arndt, May 15 2011
    

Formula

G.f.: b(x)*(1-x), where b(x) is the g.f. for the primes. - Franklin T. Adams-Watters, Jun 15 2006
a(n) = prime(n+1) - prime(n). - Franklin T. Adams-Watters, Mar 31 2010
Conjectures: (i) a(n) = ceiling(prime(n)*log(prime(n+1)/prime(n))). (ii) a(n) = floor(prime(n+1)*log(prime(n+1)/prime(n))). (iii) a(n) = floor((prime(n)+prime(n+1))*log(prime(n+1)/prime(n))/2). - Thomas Ordowski, Mar 21 2013
A167770(n) == a(n)^2 (mod A000040(n+1)). - L. Edson Jeffery, Oct 01 2014
a(n) = Sum_{k=1..2^(n+1)-1} (floor(cos^2(Pi*(n+1)^(1/(n+1))/(1+primepi(k))^(1/(n+1))))). - Anthony Browne, May 11 2016
G.f.: (Sum_{k>=1} x^pi(k)) - 1, where pi(k) is the prime counting function. - Benedict W. J. Irwin, Jun 13 2016
Conjecture: Limit_{N->oo} (Sum_{n=2..N} log(a(n))) / (Sum_{n=2..N} log(log(prime(n)))) = 1. - Alain Rocchelli, Dec 16 2022
Conjecture: The asymptotic limit of the average of log(a(n)) ~ log(log(prime(n))) - gamma (where gamma is Euler's constant). Also, for n tending to infinity, the geometric mean of a(n) is equivalent to log(prime(n)) / e^gamma. - Alain Rocchelli, Jan 23 2023
It has been conjectured that primes are distributed around their average spacing in a Poisson distribution (cf. D. A. Goldston in above links). This is the basis of the last two conjectures above. - Alain Rocchelli, Feb 10 2023

Extensions

More terms from James Sellers, Feb 19 2001

A057820 First differences of sequence of consecutive prime powers (A000961).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 2, 3, 1, 2, 4, 2, 2, 2, 2, 1, 5, 4, 2, 4, 2, 4, 6, 2, 3, 3, 4, 2, 6, 2, 2, 6, 8, 4, 2, 4, 2, 4, 8, 4, 2, 1, 3, 6, 2, 10, 2, 6, 6, 4, 2, 4, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 2, 8, 5, 1, 6, 6, 2, 6, 4, 2, 6, 4, 14, 4, 2, 4, 14, 6, 6, 4, 2, 4, 6, 2, 6, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10
Offset: 1

Views

Author

Labos Elemer, Nov 08 2000

Keywords

Comments

a(n) = 1 iff A000961(n) = A006549(k) for some k. - Reinhard Zumkeller, Aug 25 2002
Also run lengths of distinct terms in A070198. - Reinhard Zumkeller, Mar 01 2012
Does this sequence contain all positive integers? - Gus Wiseman, Oct 09 2024

Examples

			Odd differences arise in pairs in neighborhoods of powers of 2, like {..,2039,2048,2053,..} gives {..,11,5,..}
		

Crossrefs

For perfect-powers (A001597) we have A053289.
For non-perfect-powers (A007916) we have A375706.
Positions of ones are A375734.
Run-compression is A376308.
Run-lengths are A376309.
Sorted positions of first appearances are A376340.
The second (instead of first) differences are A376596, zeros A376597.
Prime-powers:
- terms: A000961 or A246655, complement A024619
- differences: A057820 (this), first appearances A376341
- anti-runs: A373576, A120430, A006549, A373671
Non-prime-powers:
- terms: A361102
- differences: A375708 (ones A375713)
- anti-runs: A373679, A373575, A255346, A373672

Programs

  • Haskell
    a057820_list = zipWith (-) (tail a000961_list) a000961_list
    -- Reinhard Zumkeller, Mar 01 2012
    
  • Maple
    A057820 := proc(n)
            A000961(n+1)-A000961(n) ;
    end proc: # R. J. Mathar, Sep 23 2016
  • Mathematica
    Map[Length, Split[Table[Apply[LCM, Range[n]], {n, 1, 150}]]] (* Geoffrey Critzer, May 29 2015 *)
    Join[{1},Differences[Select[Range[500],PrimePowerQ]]] (* Harvey P. Dale, Apr 21 2022 *)
  • PARI
    isA000961(n) = (omega(n) == 1 || n == 1)
    n_prev=1;for(n=2,500,if(isA000961(n),print(n-n_prev);n_prev=n)) \\ Michael B. Porter, Oct 30 2009
    
  • Python
    from sympy import primepi, integer_nthroot
    def A057820(n):
        def f(x): return int(n+x-1-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        r, k = m, f(m)+1
        while r != k: r, k = k, f(k)+1
        return r-m # Chai Wah Wu, Sep 12 2024

Formula

a(n) = A000961(n+1) - A000961(n).

Extensions

Offset corrected and b-file adjusted by Reinhard Zumkeller, Mar 03 2012

A029707 Numbers n such that the n-th and the (n+1)-st primes are twin primes.

Original entry on oeis.org

2, 3, 5, 7, 10, 13, 17, 20, 26, 28, 33, 35, 41, 43, 45, 49, 52, 57, 60, 64, 69, 81, 83, 89, 98, 104, 109, 113, 116, 120, 140, 142, 144, 148, 152, 171, 173, 176, 178, 182, 190, 201, 206, 209, 212, 215, 225, 230, 234, 236, 253, 256, 262, 265, 268, 277
Offset: 1

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Numbers m such that prime(m)^2 == 1 mod (prime(m) + prime(m + 1)). - Zak Seidov, Sep 18 2013
First differences are A027833. The complement is A049579. - Gus Wiseman, Dec 03 2024

Crossrefs

Cf. A014574, A027833 (first differences), A007508. Equals PrimePi(A001359) (cf. A000720).
The complement is A049579, first differences A251092 except first term.
Lengths of runs of terms differing by 2 are A179067.
The first differences have run-lengths A373820 except first term.
A000040 lists the primes, differences A001223 (run-lengths A333254, A373821).
A038664 finds the first prime gap of 2n.
A046933 counts composite numbers between primes.
For prime runs: A005381, A006512, A025584, A067774.

Programs

  • Maple
    A029707 := proc(n)
        numtheory[pi](A001359(n)) ;
    end proc:
    seq(A029707(n),n=1..30); # R. J. Mathar, Feb 19 2017
  • Mathematica
    Select[ Range@300, PrimeQ[ Prime@# + 2] &] (* Robert G. Wilson v, Mar 11 2007 *)
    Flatten[Position[Flatten[Differences/@Partition[Prime[Range[100]],2,1]], 2]](* Harvey P. Dale, Jun 05 2014 *)
  • Sage
    def A029707(n) :
       a = [ ]
       for i in (1..n) :
          if (nth_prime(i+1)-nth_prime(i) == 2) :
             a.append(i)
       return(a)
    A029707(277) # Jani Melik, May 15 2014

Formula

a(n) = A107770(n) - 1. - Juri-Stepan Gerasimov, Dec 16 2009

A373949 Triangle read by rows where T(n,k) is the number of integer compositions of n such that replacing each run of repeated parts with a single part (run-compression) yields a composition of k.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 0, 3, 0, 1, 1, 2, 4, 0, 1, 0, 4, 4, 7, 0, 1, 1, 5, 6, 5, 14, 0, 1, 0, 6, 10, 10, 14, 23, 0, 1, 1, 6, 14, 12, 29, 26, 39, 0, 1, 0, 9, 16, 19, 40, 54, 46, 71, 0, 1, 1, 8, 22, 22, 64, 82, 96, 92, 124, 0, 1, 0, 10, 26, 30, 82, 137, 144, 204, 176, 214
Offset: 0

Views

Author

Gus Wiseman, Jun 28 2024

Keywords

Examples

			Triangle begins:
   1
   0   1
   0   1   1
   0   1   0   3
   0   1   1   2   4
   0   1   0   4   4   7
   0   1   1   5   6   5  14
   0   1   0   6  10  10  14  23
   0   1   1   6  14  12  29  26  39
   0   1   0   9  16  19  40  54  46  71
   0   1   1   8  22  22  64  82  96  92 124
   0   1   0  10  26  30  82 137 144 204 176 214
   0   1   1  11  32  31 121 186 240 331 393 323 378
Row n = 6 counts the following compositions:
  .  (111111)  (222)  (33)     (3111)   (411)   (6)
                      (2211)   (1113)   (114)   (51)
                      (1122)   (1221)   (1311)  (15)
                      (21111)  (12111)  (1131)  (42)
                      (11112)  (11211)  (2112)  (24)
                               (11121)          (141)
                                                (321)
                                                (312)
                                                (231)
                                                (213)
                                                (132)
                                                (123)
                                                (2121)
                                                (1212)
For example, the composition (1,2,2,1) with compression (1,2,1) is counted under T(6,4).
		

Crossrefs

Column k = n is A003242 (anti-runs or compressed compositions).
Row-sums are A011782.
Same as A373951 with rows reversed.
Column k = 3 is A373952.
This statistic is represented by A373953, difference A373954.
A114901 counts compositions with no isolated parts.
A116861 counts partitions by compressed sum, by compressed length A116608.
A124767 counts runs in standard compositions, anti-runs A333381.
A240085 counts compositions with no unique parts.
A333755 counts compositions by compressed length.
A373948 represents the run-compression transformation.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations /@ IntegerPartitions[n],Total[First/@Split[#]]==k&]], {n,0,10},{k,0,n}]
  • PARI
    T_xy(row_max) = {my(N=row_max+1, x='x+O('x^N), h=1/(1-sum(i=1,N, (y^i*x^i)/(1+x^i*(y^i-1))))); vector(N, n, Vecrev(polcoeff(h, n-1)))}
    T_xy(13) \\ John Tyler Rascoe, Mar 20 2025

Formula

G.f.: 1/(1 - Sum_{i>0} (y^i * x^i)/(1 + x^i * (y^i - 1))). - John Tyler Rascoe, Mar 20 2025

A373948 Run-compression encoded as a transformation of compositions in standard order.

Original entry on oeis.org

0, 1, 2, 1, 4, 5, 6, 1, 8, 9, 2, 5, 12, 13, 6, 1, 16, 17, 18, 9, 20, 5, 22, 5, 24, 25, 6, 13, 12, 13, 6, 1, 32, 33, 34, 17, 4, 37, 38, 9, 40, 41, 2, 5, 44, 45, 22, 5, 48, 49, 50, 25, 52, 13, 54, 13, 24, 25, 6, 13, 12, 13, 6, 1, 64, 65, 66, 33, 68, 69, 70, 17, 72
Offset: 0

Views

Author

Gus Wiseman, Jun 24 2024

Keywords

Comments

The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
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, compression removes all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has compression (1,2,1).
For the present sequence, the a(n)-th composition in standard order is obtained by compressing the n-th composition in standard order.

Examples

			The standard compositions and their compressions begin:
   0: ()        -->  0: ()
   1: (1)       -->  1: (1)
   2: (2)       -->  2: (2)
   3: (1,1)     -->  1: (1)
   4: (3)       -->  4: (3)
   5: (2,1)     -->  5: (2,1)
   6: (1,2)     -->  6: (1,2)
   7: (1,1,1)   -->  1: (1)
   8: (4)       -->  8: (4)
   9: (3,1)     -->  9: (3,1)
  10: (2,2)     -->  2: (2)
  11: (2,1,1)   -->  5: (2,1)
  12: (1,3)     --> 12: (1,3)
  13: (1,2,1)   --> 13: (1,2,1)
  14: (1,1,2)   -->  6: (1,2)
  15: (1,1,1,1) -->  1: (1)
		

Crossrefs

Positions of 1's are A000225.
The image is A333489, counted by A003242.
Sum of standard composition for a(n) is given by A373953, length A124767.
A037201 gives compression of first differences of primes, halved A373947.
A066099 lists the parts of all compositions in standard order.
A114901 counts compositions with no isolated parts.
A116861 counts partitions by compressed sum, by length A116608.
A240085 counts compositions with no unique parts.
A333755 counts compositions by compressed length.
A373949 counts compositions by compressed sum, opposite A373951.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    stcinv[q_]:=Total[2^(Accumulate[Reverse[q]])]/2;
    Table[stcinv[First/@Split[stc[n]]],{n,0,30}]

Formula

A029837(a(n)) = A373953(n).
A000120(a(n)) = A124767(n).

A373953 Sum of run-compression of the n-th integer composition in standard order.

Original entry on oeis.org

0, 1, 2, 1, 3, 3, 3, 1, 4, 4, 2, 3, 4, 4, 3, 1, 5, 5, 5, 4, 5, 3, 5, 3, 5, 5, 3, 4, 4, 4, 3, 1, 6, 6, 6, 5, 3, 6, 6, 4, 6, 6, 2, 3, 6, 6, 5, 3, 6, 6, 6, 5, 6, 4, 6, 4, 5, 5, 3, 4, 4, 4, 3, 1, 7, 7, 7, 6, 7, 7, 7, 5, 7, 4, 5, 6, 7, 7, 6, 4, 7, 7, 7, 6, 5, 3, 5
Offset: 0

Views

Author

Gus Wiseman, Jun 25 2024

Keywords

Comments

The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
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, compression removes all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has compression (1,2,1).

Examples

			The standard compositions and their compressions and compression sums begin:
   0: ()        --> ()      --> 0
   1: (1)       --> (1)     --> 1
   2: (2)       --> (2)     --> 2
   3: (1,1)     --> (1)     --> 1
   4: (3)       --> (3)     --> 3
   5: (2,1)     --> (2,1)   --> 3
   6: (1,2)     --> (1,2)   --> 3
   7: (1,1,1)   --> (1)     --> 1
   8: (4)       --> (4)     --> 4
   9: (3,1)     --> (3,1)   --> 4
  10: (2,2)     --> (2)     --> 2
  11: (2,1,1)   --> (2,1)   --> 3
  12: (1,3)     --> (1,3)   --> 4
  13: (1,2,1)   --> (1,2,1) --> 4
  14: (1,1,2)   --> (1,2)   --> 3
  15: (1,1,1,1) --> (1)     --> 1
		

Crossrefs

Positions of 1's are A000225.
Counting partitions by this statistic gives A116861, by length A116608.
For length instead of sum we have A124767, counted by A238279 and A333755.
Compositions counted by this statistic are A373949, opposite A373951.
A037201 gives compression of first differences of primes, halved A373947.
A066099 lists the parts of all compositions in standard order.
A114901 counts compositions with no isolated parts.
A240085 counts compositions with no unique parts.
A333489 ranks anti-runs, counted by A003242.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Table[Total[First/@Split[stc[n]]],{n,0,100}]

Formula

a(n) = A029837(A373948(n)).
Showing 1-10 of 42 results. Next