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

A080791 Number of nonleading 0's in binary expansion of n.

Original entry on oeis.org

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

Views

Author

Cino Hilliard, Mar 25 2003

Keywords

Comments

In this version we consider the number zero to have no nonleading 0's, thus a(0) = 0. The variant A023416 has a(0) = 1.
Number of steps required to reach 1, starting at n + 1, under the operation: if x is even divide by 2 else add 1. This is the x + 1 problem (as opposed to the 3x + 1 problem).

Examples

			a(4) = 2 since 4 in binary is 100, which has two zeros.
a(5) = 1 since 5 in binary is 101, which has only one zero.
		

Crossrefs

Programs

  • Maple
    seq(numboccur(0, Bits[Split](n)), n=0..100); # Robert Israel, Oct 26 2017
  • Mathematica
    {0}~Join~Table[Last@ DigitCount[n, 2], {n, 120}] (* Michael De Vlieger, Mar 07 2016 *)
    f[n_] := If[OddQ@ n, f[n -1] -1, f[n/2] +1]; f[0] = f[1] = 0; Array[f, 105, 0] (* Robert G. Wilson v, May 21 2017 *)
    Join[{0}, Table[Count[IntegerDigits[n, 2], 0], {n, 1, 100}]] (* Vincenzo Librandi, Oct 27 2017 *)
  • PARI
    a(n)=if(n,a(n\2)+1-n%2)
    
  • PARI
    A080791(n)=if(n,logint(n,2)+1-hammingweight(n)) \\ M. F. Hasler, Oct 26 2017
    
  • Python
    def a(n): return bin(n)[2:].count("0") if n>0 else 0 # Indranil Ghosh, Apr 10 2017
  • Scheme
    ;; with memoizing definec-macro from Antti Karttunen's IntSeq-library)
    (define (A080791 n) (- (A029837 (+ 1 n)) (A000120 n)))
    ;; Alternative version based on a simple recurrence:
    (definec (A080791 n) (if (zero? n) 0 (+ (A080791 (- n 1)) (A007814 n) (A036987 (- n 1)) -1)))
    ;; from Antti Karttunen, Dec 12 2013
    

Formula

From Antti Karttunen, Dec 12 2013: (Start)
a(n) = A029837(n+1) - A000120(n).
a(0) = 0, and for n > 0, a(n) = (a(n-1) + A007814(n) + A036987(n-1)) - 1.
For all n >= 1, a(A054429(n)) = A048881(n-1) = A000120(n) - 1.
Equally, for all n >= 1, a(n) = A000120(A054429(n)) - 1.
(End)
Recurrence: a(2n) = a(n) + 1 (for n > 0), a(2n + 1) = a(n). - Ralf Stephan from Cino Hilliard's PARI program, Dec 16 2013. Corrected by Alonso del Arte, May 21 2017 after consultation with Chai Wah Wu and Ray Chandler, "n > 0" added by M. F. Hasler, Oct 26 2017
a(n) = A023416(n) for all n > 0. - M. F. Hasler, Oct 26 2017
G.f. g(x) satisfies g(x) = (1+x)*g(x^2) + x^2/(1-x^2). - Robert Israel, Oct 26 2017

A117479 Number of zeros in the maximal Fibonacci bit-representation of n (A104326).

Original entry on oeis.org

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

Views

Author

Casey Mongoven, Mar 20 2006

Keywords

Examples

			a(7) = 2 because A104326(7) = 1010 contains 2 zeros.
		

Crossrefs

A227352 Permutation of nonnegative integers: map each number by lengths of runs in its binary representation to the number in whose once left-shifted Zeckendorf representation occurs the same run lengths (in the same order) as the lengths of consecutive blocks of zeros.

Original entry on oeis.org

0, 1, 4, 2, 7, 12, 6, 3, 11, 19, 33, 20, 10, 17, 9, 5, 18, 30, 51, 31, 54, 88, 53, 32, 16, 27, 46, 28, 15, 25, 14, 8, 29, 48, 80, 49, 83, 135, 82, 50, 87, 142, 232, 143, 86, 140, 85, 52, 26, 43, 72, 44, 75, 122, 74, 45, 24, 40, 67, 41, 23, 38, 22, 13, 47, 77
Offset: 0

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

See the comments at the inverse permutation A227351 where the idea behind this mapping is explained.

Crossrefs

Inverse permutation: A227351. Cf. A048680, A003188.

Programs

Formula

a(n) = A048680(A003188(n)). [The defining formula]
Moreover, this permutation effects the following correspondences:
For n>=1 A000523(n) = A102364(a(n)).
For all n, A167489(n) = A227355(a(2n+1)).

A227355 Product of run lengths in Zeckendorf representation of n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

The same sequence also gives the product for the lengths of zero-runs only, as by definition, no two consecutive 1's can occur in Fibonacci number system (aka Zeckendorf representation), thus any 1's present contribute just *1 to the total product.

Crossrefs

Programs

Formula

a(n) = A167489(A003714(n)) = A227350(A003714(n)).
a(A227352(A005408(n))) = A167489(n).
For n>= 3, a(A000045(n)) = n-2.

A371590 Irregular table T(n, k), n >= 0, k = 1..max(2, 2^n), read by rows; the n-th row lists the nonnegative numbers whose Zeckendorf-binary representation has n nonleading zeros.

Original entry on oeis.org

0, 1, 2, 4, 3, 6, 7, 12, 5, 9, 10, 11, 17, 19, 20, 33, 8, 14, 15, 16, 18, 25, 27, 28, 30, 31, 32, 46, 51, 53, 54, 88, 13, 22, 23, 24, 26, 29, 38, 40, 41, 43, 44, 45, 48, 49, 50, 52, 67, 72, 74, 75, 80, 82, 83, 85, 86, 87, 122, 135, 140, 142, 143, 232
Offset: 0

Views

Author

Rémy Sigrist, Mar 28 2024

Keywords

Comments

As a flat sequence, this is a permutation of the nonnegative integers with inverse A371591.

Examples

			Array T(n, k) begins:
    0, 1
    2, 4
    3, 6, 7, 12
    5, 9, 10, 11, 17, 19, 20, 33
    8, 14, 15, 16, 18, 25, 27, 28, 30, 31, 32, 46, 51, 53, 54, 88
    ...
		

Crossrefs

See A371592 for a similar sequence.
Cf. A000045, A027941, A102364, A371591 (inverse).

Programs

  • PARI
    \\ See Links section.

Formula

A102364(T(n, k)) = n.
T(n, 1) = A000045(n + 2) for any n > 0.
T(n, max(2, 2^n)) = A027941(n + 1) for any n >= 0.

A131340 Number of 0's in minimal Lucas representation (A130310) of n.

Original entry on oeis.org

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

Views

Author

Casey Mongoven, Jun 29 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{s = {}, m = n, k = 1}, While[m > 0, If[m == 1, k = 1; AppendTo[s, k]; m = 0, If[m == 2, k = 0; AppendTo[s, k]; m = 0, While[LucasL[k] <= m, k++]; k--; AppendTo[s, k]; m -= LucasL[k]; k = 1]]]; Total[1 - IntegerDigits[Total[2^s], 2]]]; Array[a, 100] (* Amiram Eldar, Jul 05 2025 *)

Extensions

More terms from Amiram Eldar, Jul 05 2025

A131341 Number of 0's in maximal Lucas representation (A130311) of n.

Original entry on oeis.org

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

Views

Author

Casey Mongoven, Jun 29 2007, corrected Mar 23 2008

Keywords

Crossrefs

Programs

  • Mathematica
    lazy = Select[IntegerDigits[Range[400], 2], SequenceCount[#, {0, 0}] == 0 &]; t = Total[#*Reverse@LucasL[Range[0, Length[#] - 1]]] & /@ lazy; Plus @@@ (1 - lazy[[TakeWhile[Flatten[FirstPosition[t, #] & /@ Range[Max[t]]], NumberQ]]]) (* Amiram Eldar, Jul 05 2025 *)

Extensions

More terms from Amiram Eldar, Jul 05 2025

A356894 a(n) is the number of 0's in the maximal tribonacci representation of n (A352103).

Original entry on oeis.org

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

Views

Author

Amiram Eldar, Sep 03 2022

Keywords

Examples

			  n  a(n)  A352103(n)
  -  ----  ----------
  0     1           0
  1     0           1
  2     1          10
  3     0          11
  4     2         100
  5     1         101
  6     1         110
  7     0         111
  8     2        1001
  9     2        1010
		

Crossrefs

Similar sequences: A023416, A102364, A117479, A278042.

Programs

  • Mathematica
    t[1] = 1; t[2] = 2; t[3] = 4; t[n_] := t[n] = t[n - 1] + t[n - 2] + t[n - 3]; trib[n_] := Module[{s = {}, m = n, k}, While[m > 0, k = 1; While[t[k] <= m, k++]; k--; AppendTo[s, k]; m -= t[k]; k = 1]; IntegerDigits[Total[2^(s - 1)], 2]]; a[n_] := Module[{v = trib[n]}, nv = Length[v]; i = 1; While[i <= nv - 3, If[v[[i ;; i + 3]] == {1, 0, 0, 0}, v[[i ;; i + 3]] = {0, 1, 1, 1}; If[i > 3, i -= 4]]; i++]; i = Position[v, _?(# > 0 &)]; If[i == {}, 1, Count[v[[i[[1, 1]] ;; -1]], 0]]]; Array[a, 100, 0]

Formula

a(n) = A356895(n) - A352104(n).

A212278 Number of adjacent pairs of zeros (possibly overlapping) in the representation of n in base of Fibonacci numbers (A014417).

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, May 13 2012

Keywords

Comments

a(n) = 0 only if n = Fibonacci(k)-1.

Examples

			A014417(5) = 1000, two pairs of adjacent zeros, so a(5) = 2.
		

Crossrefs

Programs

  • Maple
    F:= combinat[fibonacci]:
    b:= proc(n) option remember; local j;
          if n=0 then 0
        else for j from 2 while F(j+1)<=n do od;
             b(n-F(j))+2^(j-2)
          fi
        end:
    a:= proc(n) local c, h, m, t;
          c, t, m:= 0, 1, b(n);
          while m>0 do
            h:= irem(m, 2, 'm');
            if h=t and h=0 then c:=c+1 fi;
            t:=h
          od; c
        end:
    seq(a(n), n=0..150);  # Alois P. Heinz, May 18 2012
Showing 1-9 of 9 results.