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-8 of 8 results.

A042963 Numbers congruent to 1 or 2 mod 4.

Original entry on oeis.org

1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30, 33, 34, 37, 38, 41, 42, 45, 46, 49, 50, 53, 54, 57, 58, 61, 62, 65, 66, 69, 70, 73, 74, 77, 78, 81, 82, 85, 86, 89, 90, 93, 94, 97, 98, 101, 102, 105, 106, 109, 110, 113, 114, 117, 118, 121, 122, 125, 126, 129, 130, 133, 134, 137, 138
Offset: 1

Views

Author

Keywords

Comments

Complement of A014601. - Reinhard Zumkeller, Oct 04 2004
Let S(x) = (1, 2, 2, 2, ...). Then A042963 = ((S(x))^2 + S(x^2))/2 = ((1, 4, 8, 12, 16, 20, ...) + (1, 0, 2, 0, 2, 0, 2, ...))/2 = (1, 2, 5, 6, 9, 10, ...). - Gary W. Adamson, Jan 03 2011
(a(n)*(a(n) + 1 + 4*k))/2 is odd, for k >= 0. - Gionata Neri, Jul 19 2015
Equivalent to the following variation on Fermat's Diophantine m-tuple: 1 + the product of any two distinct terms is not a square; this sequence, which we'll call sequence S, is produced by the following algorithm. At the start, S is initially empty. At stage n, starting at n = 1, the algorithm checks whether there exists a number m already in the sequence, such that mn+1 is a perfect square. If such a number m is found, then n is not added to the sequence; otherwise, n is added. Then n is incremented to n + 1, and we repeat the procedure. Proof by Clark R. Lyons: We prove by strong induction that n is in the sequence S if and only if n == 1 (mod 4) or n == 2 (mod 4). Suppose now that this holds for all k < n. In case 1, either n == 1 (mod 4) or n == 2 (mod 4), and we wish to show that n does indeed enter the sequence S. That is, we wish to show that there does not exist m < n, already in the sequence at this point such that mn+1 is a square. By the inductive hypothesis m == 1 (mod 4) or m == 2 (mod 4). This means that both m and n are one of 1, 2, 5, or 6 mod 8. Using a multiplication table mod 8, we see that this implies mn+1 is congruent to one of 2, 3, 5, 6, or 7 mod 8. But we also see that mod 8, a perfect square is congruent to 0, 1, or 4. Thus mn+1 is not a perfect square, so n is added to the sequence. In case 2, n == 0 (mod 4) or n == 3 (mod 4), and we wish to show that n is not added to the sequence. That is, we wish to show that there exists m < n already in the sequence such that mn+1 is a perfect square. For this we let m = n - 2, which is positive since n >= 3. By the inductive hypothesis, since m == 1 (mod 4) or m == 2 (mod 4) and m < n, m is already in the sequence. And we have m*n + 1 = (n - 2)*n + 1 = n^2 - 2*n + 1 = (n - 1)^2, so mn+1 is indeed a perfect square, and so n is not added to the sequence. Thus n is added to the sequence if and only if n == 1 (mod 4) or n == 2 (mod 4). This completes the proof. - Robert C. Lyons, Jun 30 2016
Also the number of maximal cliques in the (n + 1) X (n + 1) black bishop graph. - Eric W. Weisstein, Dec 01 2017
Lexicographically earliest sequence of distinct positive integers such that the average of any two or more consecutive terms is never an integer. (For opposite property see A005408.) - Ivan Neretin, Dec 21 2017
Numbers whose binary reflected Gray code (A014550) ends with 1. - Amiram Eldar, May 17 2021
Also: append its negated last bit to n-1. - M. F. Hasler, Oct 17 2022

Crossrefs

Cf. A153284 (first differences), A014848 (partial sums).
Cf. A014550, A046712 (subsequence).
Union of A016813 and A016825.

Programs

  • Haskell
    a042963 n = a042963_list !! (n-1)
    a042963_list = [x | x <- [0..], mod x 4 `elem` [1,2]]
    -- Reinhard Zumkeller, Feb 14 2012
  • Magma
    [ n : n in [1..165] | n mod 4 eq 1 or n mod 4 eq 2 ]; // Vincenzo Librandi, Jan 25 2011
    
  • Maple
    A046923:=n->(n mod 2) + 2n - 2; seq(A046923(n), n=1..100); # Wesley Ivan Hurt, Oct 10 2013
  • Mathematica
    Select[Range[109], Or[Mod[#, 4] == 1, Mod[#, 4] == 2] &] (* Ant King, Nov 17 2010 *)
    Table[(4 n - 3 - (-1)^n)/2, {n, 20}] (* Eric W. Weisstein, Dec 01 2017 *)
    LinearRecurrence[{1, 1, -1}, {1, 2, 5}, 20] (* Eric W. Weisstein, Dec 01 2017 *)
    CoefficientList[Series[(1 + x + 2 x^2)/((-1 + x)^2 (1 + x)), {x, 0, 20}], x] (* Eric W. Weisstein, Dec 01 2017 *)
  • PARI
    a(n)=2*n-1-(n-1)%2 \\ Jianing Song, Oct 06 2018; adapted to offset by Michel Marcus, Sep 09 2022
    
  • PARI
    apply( A042963(n)=n*2-2+n%2, [1..99]) \\ M. F. Hasler, Oct 17 2022
    

Formula

a(n) = 1 + A042948(n-1). [Corrected by Jianing Song, Oct 06 2018]
From Michael Somos, Jan 12 2000: (Start)
G.f.: x*(1 + x + 2*x^2)/((1 - x)^2*(1 + x)).
a(n) = a(n-1) + 2 + (-1)^n, a(0) = 1. (End) [This uses offset 0. - Jianing Song, Oct 06 2018]
A014493(n) = A000217(a(n)). - Reinhard Zumkeller, Oct 04 2004, Feb 14 2012
a(n) = Sum_{k=0..n} (A001045(k) mod 4). - Paul Barry, Mar 12 2004
A145768(a(n)) is odd. - Reinhard Zumkeller, Jun 05 2012
a(n) = A005843(n-1) + A059841(n-1). - Philippe Deléham, Mar 31 2009 [Corrected by Jianing Song, Oct 06 2018]
a(n) = 4*n - a(n-1) - 5 for n > 1. [Corrected by Jerzy R Borysowicz, Jun 09 2023]
From Ant King, Nov 17 2010: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3).
a(n) = (4*n - 3 - (-1)^n)/2. (End)
a(n) = (n mod 2) + 2*n - 2. - Wesley Ivan Hurt, Oct 10 2013
A163575(a(n)) = n - 1. - Reinhard Zumkeller, Jul 22 2014
E.g.f.: 2 + (2*x - 1)*sinh(x) + 2*(x - 1)*cosh(x). - Ilya Gutkovskiy, Jun 30 2016
E.g.f.: 2 + (2*x - 1)*exp(x) - cosh(x). - David Lovler, Jul 19 2022
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/8 + log(2)/4. - Amiram Eldar, Dec 05 2021

Extensions

Offset corrected by Reinhard Zumkeller, Feb 14 2012
More terms by David Lovler, Jul 19 2022

A227183 a(n) is the sum of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n; row sums of A227739 for n >= 1.

Original entry on oeis.org

0, 1, 2, 2, 4, 3, 3, 3, 6, 5, 4, 6, 5, 4, 4, 4, 8, 7, 6, 8, 8, 5, 7, 9, 7, 6, 5, 7, 6, 5, 5, 5, 10, 9, 8, 10, 10, 7, 9, 11, 12, 9, 6, 10, 11, 8, 10, 12, 9, 8, 7, 9, 9, 6, 8, 10, 8, 7, 6, 8, 7, 6, 6, 6, 12, 11, 10, 12, 12, 9, 11, 13, 14, 11, 8, 12, 13, 10, 12, 14
Offset: 0

Views

Author

Antti Karttunen, Jul 05 2013

Keywords

Comments

Like A129594 this sequence utilizes the fact that compositions (i.e., ordered partitions) can be bijectively mapped to (unordered) partitions by taking the partial sums of the list of composants after one has been subtracted from each except the first one. Compositions in turn are mapped to nonnegative integers via the runlength encoding, where the lengths of maximum runs of 0's or 1's in binary representation of n give the composants. See the OEIS Wiki page and the example below.
Each n occurs A000041(n) times in total and occurs for the first time at A227368(n) and for the last time at position A000225(n). See further comments and conjectures at A227368 and A227370.

Examples

			19 has binary expansion "10011", thus the maximal runs of identical bits (scanned from right to left) are [2,2,1]. We subtract one from each after the first one, to get [2,1,0] and then form their partial sums as [2,2+1,2+1+0], which thus maps to unordered partition {2+3+3} which adds to 8. Thus a(19)=8.
		

Crossrefs

Row sums of A227189 and A227739. Cf. A227184 (corresponding products), A227185, A227189, A227192, A129594, A226062, A227368.
Analogous sum sequences computed for other encoding schemes of unordered partitions: A036042, A056239, A161511, A243503. Cf. also A229119, A003188, A075157, A243353 (associated permutations mapping between these schemes).

Programs

  • Mathematica
    Table[Function[b, Total@ Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b] - Boole[n == 0]]@ Map[Length, Split@ Reverse@ IntegerDigits[n, 2]], {n, 0, 79}] // Flatten (* Michael De Vlieger, May 09 2017 *)
  • Python
    def A227183(n):
      '''Sum of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n.'''
      s = 0
      b = n%2
      i = 1
      while (n != 0):
        n >>= 1
        if ((n%2) == b): # Staying in the same run of bits?
          i += 1
        else: # The run changes.
          b = n%2
          s += i
      return(s)

Formula

a(n) = Sum_{i=0..A005811(n)-1} A227189(n,i). [The defining formula]
Equivalently, for n>=1, a(n) = Sum_{i=(A173318(n-1)+1)..A173318(n)} A227739(i).
a(n) = A227192(n) - A000217(A005811(n)-1).
Other identities:
a(A129594(n)) = a(n). [This follows from the fact that conjugating a partition doesn't change its total sum]
a(A226062(n)) = a(n). [Which is also true for the "Bulgarian operation"]
From Antti Karttunen, Mar 08 2015: (Start)
Can be also obtained by mapping with an appropriate permutation from the sequences giving sizes of each partition (i.e., sum of their parts) computed for other enumerations similar to A227739:
a(n) = A036042(A229119(n)).
a(n) = A161511(A003188(n)).
a(n) = A056239(A243353(n)).
a(n) = A243503(1+A075157(n)).
(End)

A136480 Number of trailing equal digits in binary representation of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 31 2007

Keywords

Comments

a(even) = number of trailing binary zeros;
a(odd) = number of trailing binary ones.
For n>0, power of 2 associated with n^2 + n, e.g. n=4 gives 20, so a(4)=2. - Jon Perry, Sep 12 2014

Crossrefs

Programs

  • Haskell
    a136480 0 = 1
    a136480 n = a007814 $ n + mod n 2  -- Reinhard Zumkeller, Jul 22 2014
    
  • JavaScript
    for (n=1;n<120;n++) {
    m=n*n+n;
    c=0;
    while (m%2==0) {m/=2;c++;}
    document.write(c+", ");
    }  // Jon Perry, Sep 12 2014
    
  • Maple
    A136480 := proc(n)
        if n = 0 then
            1;
        else
            A007814(n*(n+1)) ;
        end if;
    end proc:
    seq( A136480(n),n=0..80) ; # R. J. Mathar, Mar 20 2023
  • Mathematica
    Length[Last[Split[IntegerDigits[#,2]]]]&/@Range[0,140]  (* Harvey P. Dale, Mar 31 2011 *)
  • PARI
    a(n)=if (n, valuation(n+n%2,2), 1) \\ Charles R Greathouse IV, Oct 14 2013
    
  • Python
    def A136480(n): return (~(m:=n+(n&1))& m-1).bit_length() # Chai Wah Wu, Jul 08 2022

Formula

a(n) = A050603(n-1) for n>0;
a(2*n + n mod 2) = a(n) + 1.
For n>0: a(n) = A007814(n + n mod 2).
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=0..m} a(k) = 2. - Amiram Eldar, Sep 15 2022
a(n) = A007814(A002378(n)), n>0. - R. J. Mathar, Mar 20 2023

A227189 Square array A(n>=0,k>=0) where A(n,k) gives the (k+1)-th part of the unordered partition which has been encoded in the binary expansion of n, as explained in A227183. The array is scanned antidiagonally as A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), etc.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 06 2013

Keywords

Comments

Discarding the trailing zero terms, on each row n there is a unique partition of integer A227183(n). All possible partitions of finite natural numbers eventually occur. The first partition that sums to n occurs at row A227368(n).
Irregular table A227739 lists only the nonzero terms.

Examples

			The top-left corner of the array:
row #  row starts as
    0  0, 0, 0, 0, 0, ...
    1  1, 0, 0, 0, 0, ...
    2  1, 1, 0, 0, 0, ...
    3  2, 0, 0, 0, 0, ...
    4  2, 2, 0, 0, 0, ...
    5  1, 1, 1, 0, 0, ...
    6  1, 2, 0, 0, 0, ...
    7  3, 0, 0, 0, 0, ...
    8  3, 3, 0, 0, 0, ...
    9  1, 2, 2, 0, 0, ...
   10  1, 1, 1, 1, 0, ...
   11  2, 2, 2, 0, 0, ...
   12  2, 3, 0, 0, 0, ...
   13  1, 1, 2, 0, 0, ...
   14  1, 3, 0, 0, 0, ...
   15  4, 0, 0, 0, 0, ...
   16  4, 4, 0, 0, 0, ...
   17  1, 3, 3, 0, 0, ...
etc.
8 has binary expansion "1000", whose runlengths are [3,1] (the length of the run in the least significant end comes first) which maps to nonordered partition {3+3} as explained in A227183, thus row 8 begins as 3, 3, 0, 0, ...
17 has binary expansion "10001", whose runlengths are [1,3,1] which maps to nonordered partition {1,3,3}, thus row 17 begins as 1, 3, 3, ...
		

Crossrefs

Only nonzero terms: A227739. Row sums: A227183. The product of nonzero terms on row n>0 is A227184(n). Number of nonzero terms on each row: A005811. The leftmost column, after n>0: A136480. The rightmost nonzero term: A227185.
Cf. A227368 and also arrays A227186 and A227188.

Programs

A227186 Array A(n,k) read by antidiagonals: the length of the (k+1)-th run (k>=0) of binary digits of n, first run starting from the least significant bit of n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 06 2013

Keywords

Comments

A(n,k) is set to zero if there are less than k+1 runs.
The irregular table A101211 gives the nonzero terms of each row in reverse order. The terms on row n sum to A029837(n+1). The product of nonzero terms on row n>0 is A167489(n). Number of nonzero terms on each row: A005811.

Examples

			The top-left corner of the array:
0, 0, 0, 0, 0, ... (0, in binary 0, has no runs (by convention), thus at first we have all-0 sequence)
1, 0, 0, 0, 0, ... (1, in binary 1, has one run of length 1)
1, 1, 0, 0, 0, ... (2, in binary 10, has two runs of length 1 both)
2, 0, 0, 0, 0, ... (3, in binary 11, has one run of length 2)
2, 1, 0, 0, 0, ... (4, in binary 100, the rightmost run of length 2 given first, then the second run of length 1)
1, 1, 1, 0, 0, ... (5, in binary 101, has three runs of one bit each)
1, 2, 0, 0, 0, ...
3, 0, 0, 0, 0, ...
3, 1, 0, 0, 0, ...
1, 2, 1, 0, 0, ...
1, 1, 1, 1, 0, ...
2, 1, 1, 0, 0, ...
2, 2, 0, 0, 0, ...
1, 1, 2, 0, 0, ...
1, 3, 0, 0, 0, ...
4, 0, 0, 0, 0, ...
		

Crossrefs

Used to compute A227183. Cf. also A163575, A227188, A227189.

Programs

  • Maple
    A227186 := proc(n,k)
        local bdgs,ru,i,b,a;
        bdgs := convert(n,base,2) ;
        if nops(bdgs) = 0 then
            return 0 ;
        end if;
        ru := 0 ;
        i := 1 ;
        b := op(i,bdgs) ;
        a := 1 ;
        for i from 2 to nops(bdgs) do
            if op(i,bdgs) <> op(i-1,bdgs) then
                if ru = k then
                    return a;
                end if;
                a := 1 ;
                ru := ru+1 ;
            else
                a := a+1 ;
            end if;
        end do:
        if ru =k then
            a ;
        else
            0 ;
        end if;
    end proc: # R. J. Mathar, Jul 23 2013
  • PARI
    A227186(n,k)=while(k>=0,for(c=1,n,bittest(n,0)==bittest(n\=2,0)&next;k&break;return(c));n||return;k--) \\ To let A(0,0)=1 add "!n||!" in front of while(...). TO DO: add default value k=-1 and implement "flattened" sequence, such that A227186(n) yields a(n). M. Hasler, Jul 21 2013
  • Scheme
    (define (A227186 n) (A227186bi (A002262 n) (A025581 n)))
    (define (A227186bi n k) (cond ((< (A005811 n) (+ 1 k)) 0) ((zero? k) (A136480 n)) (else (A227186bi (A163575 n) (- k 1)))))
    

Formula

A(n,0) = A136480(n), n>0.

A153733 Remove all trailing 1's in the binary representation of n.

Original entry on oeis.org

0, 0, 2, 0, 4, 2, 6, 0, 8, 4, 10, 2, 12, 6, 14, 0, 16, 8, 18, 4, 20, 10, 22, 2, 24, 12, 26, 6, 28, 14, 30, 0, 32, 16, 34, 8, 36, 18, 38, 4, 40, 20, 42, 10, 44, 22, 46, 2, 48, 24, 50, 12, 52, 26, 54, 6, 56, 28, 58, 14, 60, 30, 62, 0, 64, 32, 66, 16, 68, 34, 70, 8, 72, 36, 74, 18, 76, 38
Offset: 0

Views

Author

Reinhard Zumkeller, Dec 31 2008

Keywords

Comments

a(n) is also the map n -> A065423(n+1) applied A007814(n+1) times. - Federico Provvedi, Dec 14 2021

Crossrefs

Programs

  • Haskell
    a153733 n = if b == 0 then n else a153733 n'  where (n', b) = divMod n 2
    -- Reinhard Zumkeller, Jul 22 2014
    
  • Maple
    f:= n -> (n+1)/2^padic:-ordp(n+1,2)-1:
    map(f, [$0..100]); # Robert Israel, Mar 18 2018
  • Mathematica
    Table[If[EvenQ[n],n,FromDigits[Flatten[Most[Split[IntegerDigits[n,2]]]],2]],{n,0,100}] (* Harvey P. Dale, Feb 15 2014 *)
    a[n_] := BitShiftRight[n + 1, IntegerExponent[n+1, 2]] - 1; a[Range[0,100]] (* Federico Provvedi, Dec 21 2021 *)
  • PARI
    A153733(n)=(n+=1)>>valuation(n,2)-1 \\ most efficient variant: use this. - M. F. Hasler, Mar 16 2018
    
  • PARI
    {a(n)=while(bittest(n,0),n>>=1);n} \\ for illustration: as long as there's a trailing bit 1, remove it. - M. F. Hasler, Mar 16 2018
    
  • PARI
    a(n)=for(i=0,n,bittest(n,i)||return(n>>i)) \\ scan the trailing 1's, then remove all of them at once. - M. F. Hasler, Mar 16 2018
    
  • Python
    def a(n):
        while n&1: n >>= 1
        return n
    print([a(n) for n in range(100)]) # Michael S. Branicky, Dec 18 2021
    
  • Python
    def A153733(n): return n>>(~(n+1)&n).bit_length() # Chai Wah Wu, Jul 08 2022

Formula

a(n) = n if n is even, a((n-1)/2) if odd.
a(n)/2 = A025480(n).
a(n) = A000265(n+1) - 1. - M. F. Hasler, Mar 16 2018
a(n) = n - A331739(n+1). - Federico Provvedi, Dec 21 2021

A227188 Square array A(n,k) read by antidiagonals: the one-based bit-index where the (k+1)-st run in the binary expansion of n ends, as read from the least significant end.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 06 2013

Keywords

Comments

A(n,k) is set to zero if there are fewer runs in n than k+1.
Equally, when A005811(n) > 1, A(n,k) gives the zero-based bit-index where the (k+2)-th run in the binary expansion of n starts, counted from the least significant end.
Each row gives the partial sums of the terms on the corresponding row in A227186, up to the first zero.

Examples

			The top-left corner of the array:
row #  row starts as
   0    0, 0, 0, 0, 0, ...
   1    1, 0, 0, 0, 0, ...
   2    1, 2, 0, 0, 0, ...
   3    2, 0, 0, 0, 0, ...
   4    2, 3, 0, 0, 0, ...
   5    1, 2, 3, 0, 0, ...
   6    1, 3, 0, 0, 0, ...
   7    3, 0, 0, 0, 0, ...
   8    3, 4, 0, 0, 0, ...
   9    1, 3, 4, 0, 0, ...
  10    1, 2, 3, 4, 0, ...
  11    2, 3, 4, 0, 0, ...
  12    2, 4, 0, 0, 0, ...
  13    1, 2, 4, 0, 0, ...
  14    1, 4, 0, 0, 0, ...
  15    4, 0, 0, 0, 0, ...
  16    4, 5, 0, 0, 0, ...
etc.
For example, for n = 8, whose binary expansion is "1000", we get the run lengths 3 and 1 (scanning from the right), partial sums of which are 3 and 4, thus row 8 begins as A(8,0)=3, A(8,1)=4, A(8,2)=0, ...
		

Crossrefs

Cf. A227192 (row sums). Number of nonzero terms on each row: A005811.
Cf. also A227186, A227189, A163575.

Programs

  • Maple
    A227188 := proc(n,k)
        local bdgs,ru,i,b,a;
        bdgs := convert(n,base,2) ;
        if nops(bdgs) = 0 then
            return 0 ;
        end if;
        ru := 0 ;
        i := 1 ;
        b := op(i,bdgs) ;
        for i from 2 to nops(bdgs) do
            if op(i,bdgs) <> op(i-1,bdgs) then
                if ru = k then
                    return i-1;
                end if;
                ru := ru+1 ;
            end if;
        end do:
        if ru =k then
            nops(bdgs) ;
        else
            0 ;
        end if;
    end proc: # R. J. Mathar, Jul 23 2013
  • Mathematica
    Table[PadRight[Rest@FoldList[Plus,0,Length/@Split[Reverse[IntegerDigits[j,2]]]],i+1-j][[i+1-j]],{i,0,12},{j,0,i}] (* Wouter Meeussen, Aug 31 2013 *)
  • Scheme
    (define (A227188 n) (A227188bi (A002262 n) (A025581 n)))
    (define (A227188bi n k) (cond ((< (A005811 n) (+ 1 k)) 0) ((zero? k) (A136480 n)) (else (+ (A136480 n) (A227188bi (A163575 n) (- k 1))))))

Formula

A(n,0) = A136480(n), n>0.

A227761 a(n) is the maximal difference between successive parts in the minimally runlength-encoded unordered partition of n (A227368(n)).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 1, 0, 2, 1, 0, 0, 1, 1, 1, 0, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 1, 1, 2, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 2, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 2, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 0, 0, 1, 1, 1, 1, 1
Offset: 0

Views

Author

Antti Karttunen, Jul 26 2013

Keywords

Comments

After n=3, only composites may obtain value 0. (But not all of them do; see A227762.) The first nine n for which a(n)=2 are 7, 13, 23, 33, 47, 61, 79, 97, 119, of which all are primes except 33 and 119. Conjecture: these values are given by A227786.
Are there any terms larger than 2?

Crossrefs

A227762 gives the positions of zeros, in other words, such n that their minimally runlength-encoded partition consists of identical parts.
Cf. also A227368 (for the concept of minimally runlength-encoded unordered partition).

Programs

  • Scheme
    (define (A227761 n) (if (< n 2) 0 (- (A043276 (A163575 (A227368 n))) 1)))
    ;; Alternative version which uses auxiliary functions DIFF and binexp_to_ascpart which can be found in the Program section of A129594:
    (define (A227761v2 n) (if (< n 2) 0 (apply max (DIFF (binexp_to_ascpart (A227368 n))))))

Formula

a(0) = a(1) = 0, and for n>1, a(n) = A043276(A163575(A227368(n))) - 1.
Showing 1-8 of 8 results.