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

A283972 a(n) = n minus (product of lengths of 1-runs in binary representation of n) = n - A227349(n).

Original entry on oeis.org

0, 1, 1, 3, 4, 4, 4, 7, 8, 9, 9, 10, 11, 11, 11, 15, 16, 17, 17, 19, 20, 20, 20, 22, 23, 24, 23, 25, 26, 26, 26, 31, 32, 33, 33, 35, 36, 36, 36, 39, 40, 41, 41, 42, 43, 43, 43, 46, 47, 48, 47, 50, 51, 50, 49, 53, 54, 55, 53, 56, 57, 57, 57, 63, 64, 65, 65, 67, 68, 68, 68, 71, 72, 73, 73, 74, 75, 75, 75, 79, 80, 81, 81, 83, 84, 84, 84, 86, 87, 88, 87, 89
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Crossrefs

Cf. A227349.
Cf. A227190, A284560, A284581 for similar sequences.

Programs

Formula

a(n) = n - A227349(n).

A284562 Product / LCM of the lengths of 1-runs in binary representation of n: a(n) = A227349(n) / A284569(n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A227349(n) / A284569(n).

A284582 a(n) = gcd(A227349(n), A227350(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Crossrefs

Programs

Formula

a(n) = gcd(A227349(n), A227350(n)).
A167489(n) = a(n) * A284583(n).

A284583 a(n) = lcm(A227349(n), A227350(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 14 2017

Keywords

Crossrefs

Programs

Formula

a(n) = lcm(A227349(n), A227350(n)).
A167489(n) = a(n) * A284582(n).

A253083 Partial sums of A227349.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 9, 12, 13, 14, 15, 17, 19, 21, 24, 28, 29, 30, 31, 33, 34, 35, 37, 40, 42, 44, 46, 50, 53, 56, 60, 65, 66, 67, 68, 70, 71, 72, 74, 77, 78, 79, 80, 82, 84, 86, 89, 93, 95, 97, 99, 103, 105, 107, 111, 117, 120, 123, 126, 132, 136, 140, 145, 151, 152, 153, 154, 156, 157, 158
Offset: 0

Views

Author

N. J. A. Sloane, Feb 05 2015

Keywords

Crossrefs

Cf. A227349.

A278222 The least number with the same prime signature as A005940(n+1).

Original entry on oeis.org

1, 2, 2, 4, 2, 6, 4, 8, 2, 6, 6, 12, 4, 12, 8, 16, 2, 6, 6, 12, 6, 30, 12, 24, 4, 12, 12, 36, 8, 24, 16, 32, 2, 6, 6, 12, 6, 30, 12, 24, 6, 30, 30, 60, 12, 60, 24, 48, 4, 12, 12, 36, 12, 60, 36, 72, 8, 24, 24, 72, 16, 48, 32, 64, 2, 6, 6, 12, 6, 30, 12, 24, 6, 30, 30, 60, 12, 60, 24, 48, 6, 30, 30, 60, 30, 210, 60, 120, 12, 60, 60, 180, 24, 120, 48, 96, 4, 12, 12
Offset: 0

Views

Author

Antti Karttunen, Nov 15 2016

Keywords

Comments

This sequence can be used for filtering certain base-2 related sequences, because it matches only with any such sequence b that can be computed as b(n) = f(A005940(n+1)), where f(n) is any function that depends only on the prime signature of n (some of these are listed under the index entry for "sequences computed from exponents in ...").
Matching in this context means that the sequence a matches with the sequence b iff for all i, j: a(i) = a(j) => b(i) = b(j). In other words, iff the sequence b partitions the natural numbers to the same or coarser equivalence classes (as/than the sequence a) by the distinct values it obtains.
Because the Doudna map n -> A005940(1+n) is an isomorphism from "unary-binary encoding of factorization" (see A156552) to the ordinary representation of the prime factorization of n, it follows that the equivalence classes of this sequence match with any such sequence b, where b(n) is computed from the lengths of 1-runs in the binary representation of n and the order of those 1-runs does not matter. Particularly, this holds for any sequence that is obtained as a "Run Length Transform", i.e., where b(n) = Product S(i), for some function S, where i runs through the lengths of runs of 1's in the binary expansion of n. See for example A227349.
However, this sequence itself is not a run length transform of any sequence (which can be seen for example from the fact that A046523 is not multiplicative).
Furthermore, this matches not only with sequences involving products of S(i), but with any sequence obtained with any commutative function applied cumulatively, like e.g., A000120 (binary weight, obtained in this case as Sum identity(i)), and A069010 (number of runs of 1's in binary representation of n, obtained as Sum signum(i)).

Crossrefs

Similar sequences: A278217, A278219 (other base-2 related variants), A069877 (base-10 related), A278226 (primorial base), A278234-A278236 (factorial base), A278243 (Stern polynomials), A278233 (factorization in ring GF(2)[X]), A046523 (factorization in Z).
Cf. also A286622 (rgs-transform of this sequence) and A286162, A286252, A286163, A286240, A286242, A286379, A286464, A286374, A286375, A286376, A286243, A286553 (various other sequences involving this sequence).
Sequences that partition N into same or coarser equivalence classes: too many to list all here (over a hundred). At least every sequence listed under index-entry "Run Length Transforms" is included (e.g., A227349, A246660, A278159), and also sequences like A000120 and A069010, and their combinations like A136277.

Programs

  • Mathematica
    f[n_, i_, x_] := Which[n == 0, x, EvenQ@ n, f[n/2, i + 1, x], True, f[(n - 1)/2, i, x Prime@ i]]; Array[If[# == 1, 1, Times @@ MapIndexed[ Prime[First[#2]]^#1 &, Sort[FactorInteger[#][[All, -1]], Greater]]] &@ f[# - 1, 1, 1] &, 99] (* Michael De Vlieger, May 09 2017 *)
  • PARI
    A046523(n)=factorback(primes(#n=vecsort(factor(n)[, 2], , 4)), n)
    a(n)=my(p=2, t=1); for(i=0,exponent(n), if(bittest(n,i), t*=p, p=nextprime(p+1))); A046523(t) \\ Charles R Greathouse IV, Nov 11 2021
  • Python
    from sympy import prime, factorint
    import math
    def A(n): return n - 2**int(math.floor(math.log(n, 2)))
    def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
    def a005940(n): return b(n - 1)
    def P(n):
        f = factorint(n)
        return sorted([f[i] for i in f])
    def a046523(n):
        x=1
        while True:
            if P(n) == P(x): return x
            else: x+=1
    def a(n): return a046523(a005940(n + 1)) # Indranil Ghosh, May 05 2017
    
  • Scheme
    (define (A278222 n) (A046523 (A005940 (+ 1 n))))
    

Formula

a(n) = A046523(A005940(1+n)).
a(n) = A124859(A278159(n)).
a(n) = A278219(A006068(n)).

Extensions

Misleading part of the name removed by Antti Karttunen, Apr 07 2022

A069010 Number of runs of 1's in the binary representation of n.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Apr 02 2002

Keywords

Comments

a(n) is also the number of distinct parts in the integer partition having viabin number n. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [2,2,2,1]. The southeast border of its Ferrers board yields 10100, leading to the viabin number 20. - Emeric Deutsch, Jul 24 2017
Positions of first occurrences of k are A002450(k). - John Keith, Aug 30 2021

Examples

			a(11) = 2 since 11 is 1011 in binary with two runs of 1's.
a(12) = 1 since 12 is 1100 in binary with one run of 1's.
		

Crossrefs

Cf. A268411 (parity of the terms), A268412 (positions of even terms), A268415 (of odd terms).
Cf. A002450 (positions of record highs).
Cf. also A227349, A246588.

Programs

  • Maple
    f:= proc(n) option remember; if n::even then procname(n/2)
    elif n mod 4 = 1 then 1 + procname((n-1)/2) else  procname((n-1)/2) fi end proc:
    f(0):= 0:
    map(f, [$0..1000]); # Robert Israel, Sep 06 2015
  • Mathematica
    Count[Split@ IntegerDigits[#, 2], n_ /; First@ n == 1] & /@ Range[0, 120] (* Michael De Vlieger, Sep 05 2015 *)
  • PARI
    a(n) = (1 + (hammingweight(bitxor(n, n>>1)))) >> 1;  \\ Gheorghe Coserea, Sep 05 2015
    
  • Python
    def A069010(n):
        return sum(1 for d in bin(n)[2:].split('0') if len(d)) # Chai Wah Wu, Nov 04 2016
  • Scheme
    (define (A069010 n) (/ (+ (A005811 n) (A000035 n)) 2)) ;; Antti Karttunen, Feb 05 2016
    

Formula

a(n) = ceiling(A005811(n)/2) = A005811(n) - A033264(n). If 2^k <= n < 3*2^(k-1) then a(n) = a(n-2^k)+1; if 3*2^(k-1) <= n < 2^(k+1) then a(n) = a(n-2^k).
a(2n) = a(n), a(2n+1) = a(n) + [n is even]. - Ralf Stephan, Aug 20 2003
G.f.: (1/(1-x)) * Sum_{k>=0} (t/(1+t))/(1+t^2), where t=x^2^k. - Ralf Stephan, Sep 07 2003
a(n) = A000120(n) - A014081(n) = A037800(n) + 1, n>0. - Ralf Stephan, Sep 10 2003

A106737 a(n) = Sum_{k=0..n} ({binomial(n+k,n-k)*binomial(n,k)} mod 2).

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 3, 4, 2, 4, 4, 6, 3, 6, 4, 5, 2, 4, 4, 6, 4, 8, 6, 8, 3, 6, 6, 9, 4, 8, 5, 6, 2, 4, 4, 6, 4, 8, 6, 8, 4, 8, 8, 12, 6, 12, 8, 10, 3, 6, 6, 9, 6, 12, 9, 12, 4, 8, 8, 12, 5, 10, 6, 7, 2, 4, 4, 6, 4, 8, 6, 8, 4, 8, 8, 12, 6, 12, 8, 10, 4, 8, 8, 12, 8, 16, 12, 16, 6, 12, 12, 18, 8, 16, 10, 12
Offset: 0

Views

Author

Benoit Cloitre, May 15 2005

Keywords

Comments

The formula (the recurrence, if confirmed to be equal to sum binomial formula) implies that this is the run length transform of the sequence 1,2,3,4,5,... - N. J. A. Sloane, Feb 05 2015. Note: That sequence should be considered as a successor function a(n) = n+1, starting from offset 0. See also A020725. - Antti Karttunen, Oct 15 2016
The recurrence formula is correct. See paper in links. - Chai Wah Wu, Oct 16 2016

Crossrefs

Row sums of triangle in A253084.
Cf. A000005, A005940, A020725, A227349, A277335 (positions of odd terms).
Cf. also A153013.

Programs

  • Mathematica
    Table[Sum[Mod[#, 2] &[Binomial[n + k, n - k] Binomial[n, k]], {k, 0, n}], {n, 0, 95}] (* Michael De Vlieger, Oct 17 2016 *)
  • PARI
    a(n) = sum(k=0, n, (binomial(n+k,n-k)*binomial(n,k)) % 2); \\ Michel Marcus, Dec 08 2013
    
  • Python
    def A106737(n):
        return sum(int(not (~(n+k) & (n-k)) | (~n & k)) for k in range(n+1)) # Chai Wah Wu, Feb 09 2016
    (Scheme, two mathematically equal implementations, based on RLT-interpretation)
    ;; The first one implements the given recurrence and uses memoization-macro definec:
    (definec (A106737 n) (cond ((zero? n) 1) ((even? n) (A106737 (/ n 2))) ((= 1 (modulo n 4)) (* 2 (A106737 (/ (- n 1) 2)))) (else (- (* 2 (A106737 (/ (- n 1) 2))) (A106737 (/ (- n 3) 4))))))
    ;; This one applies the Run Length Transform explicitly to r -> r+1 function:
    (define (A106737 n) (fold-left (lambda (a r) (* a (+ 1 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2))))) ;; See A227349 for the required other functions.
    ;; Antti Karttunen, Oct 15 2016

Formula

a(0)=1, a(2n) = a(n), a(4n+1) = 2*a(2n), a(4n+3) = 2*a(2n+1) - a(n).
From Antti Karttunen, Oct 15 2016: (Start)
a(n) = A000005(A005940(1+n)). [Follows from the Run Length Transform-interpretation.]
For n > 1, a(n^2) is always even. [Based on RLT-interpretation. n^2 = 1 modulo 4 for all odd n and ((2^k)*n)^2 = 2^(2k) * (n^2), thus the last 1-bit is always alone and contributes 2 to the product, making it even.]
(End)

A167489 Product of run lengths in binary representation of n.

Original entry on oeis.org

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

Views

Author

Andrew Weimholt, Nov 05 2009

Keywords

Examples

			a(56) = 9, because 56 in binary is written 111000 giving the run lengths 3,3 and 3x3 = 9.
a(99) = 12, because 99 in binary is written 1100011 giving the run lengths 2,3,2, and 2x3x2 = 12.
		

Crossrefs

Row products of A101211 and A227736 (for n > 0).
Cf. A167490 (smallest number with binary run length product = n).
Cf. A167491 (members of A167490 sorted in ascending order).
Differs from similar A284579 for the first time at n=56, where a(56) = 9, while A284579(56) = 5.

Programs

  • Haskell
    import Data.List (group)
    a167489 = product . map length . group . a030308_row
    -- Reinhard Zumkeller, Jul 05 2013
    
  • Mathematica
    Table[ Times @@ (Length /@ Split[IntegerDigits[n, 2]]), {n, 0, 100}](* Olivier Gérard, Jul 05 2013 *)
  • PARI
    a(n) = {my(p=1, b=n%2, i=0); while(n!=0, n=n>>1; i=i+1; if((n%2)!=b, p=p*i; i=0; b=n%2)); p} \\ Indranil Ghosh, Apr 17 2017, after the Python Program by Antti Karttunen
  • Python
    def A167489(n):
      '''Product of run lengths in binary representation of n.'''
      p = 1
      b = n%2
      i = 0
      while (n != 0):
        n >>= 1
        i += 1
        if ((n%2) != b):
          p *= i
          i = 0
          b = n%2
      return(p)
    # Antti Karttunen, Jul 24 2013 (Cf. Python program for A227184).
    
  • Scheme
    (define (A167489 n) (apply * (binexp->runcount1list n)))
    (define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))
    ;; Antti Karttunen, Jul 05 2013
    

Formula

a(n) = A227349(n) * A227350(n) = A227355(A227352(2n+1)). - Antti Karttunen, Jul 25 2013
a(n) = A284558(n) * A284559(n) = A284582(n) * A284583(n). - Antti Karttunen, Apr 16 2017

A085357 Common residues of binomial(3n,n)/(2n+1) modulo 2: relates ternary trees (A001764) to the infinite Fibonacci word (A003849).

Original entry on oeis.org

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

Views

Author

Paul D. Hanna, Jun 25 2003

Keywords

Comments

The n-th runs of ones is given by: 3 - A003849(n) (infinite Fibonacci word) = A076662(n+1). Runs of zeros are given by: A085358 and are also directly related to the Fibonacci sequence. Coefficients of A(x)^3 are found in A085359.
a(n) = 0 iff some binary digit of n is 1 while the corresponding binary digit of 3*n is 0. - Robert Israel, Jul 12 2016
The Run Length Transform of [0,1,0,0,0,...], A063524, the characteristic function of 1. (See A227349 for the definition). - Antti Karttunen, Oct 15 2016

Crossrefs

Cf. A001764 (ternary trees), A085358 (runs of zeros), A076662 (runs of ones), A003849 (infinite Fibonacci word), A085359 (A(x)^3).
Absolute values of A132971.

Programs

  • Magma
    [Binomial(3*n,n) mod 2: n in [0..100]]; // Vincenzo Librandi, Jul 09 2016
    
  • Maple
    f:= proc(n) local L,Lp;
      L:= convert(n,base,2);
      Lp:= convert(3*n,base,2);
      if has(L-Lp[1..nops(L)],1) then 0 else 1 fi
    end proc:
    map(f, [$0..100]); # Robert Israel, Jul 12 2016
  • Mathematica
    Table[Mod[Binomial[3 n, n], 2], {n, 0, 120}] (* Michael De Vlieger, Jul 08 2016 *)
  • PARI
    A085357(n) = !bitand(n,n<<1); \\ Antti Karttunen, Aug 22 2019
    
  • Python
    def A085357(n): return int(not n&(n<<1)) # Chai Wah Wu, Jun 25 2025

Formula

G.f.: 1 + x*A(x)^3 = A(x) (Mod 2); a(n) = A001764(n) (Mod 2).
a(n) = binomial(3n, n) (mod 2). Characteristic function of Fibbinary numbers (i.e. a(n)=1 iff n is in A003714). - Benoit Cloitre, Nov 15 2003
Recurrence: a(0) = 1, a(2n) = a(4n+1) = a(n), a(4n+3) = 0.
a(n-2) = A000256(n)(mod 2), for n>2. - John M. Campbell, Jul 08 2016
a(n) = A000621(n+1)(mod 2). - John M. Campbell, Jul 15 2016
a(n) = A000625(n)(mod 2). - John M. Campbell, Jul 15 2016
a(n) = A008966(A005940(1+n)). [Follows from the Run Length Transform interpretation, see also A277010.] - Antti Karttunen, Oct 15 2016
a(n) = abs(A132971(n)) = abs(A008683(A005940(1+n))). - Antti Karttunen, May 30 2017
Showing 1-10 of 28 results. Next