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.

Previous Showing 11-19 of 19 results.

A330036 The length of the largest run of 0's in the binary expansion of n + the length of the largest run of 1's in the binary expansion of n.

Original entry on oeis.org

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

Views

Author

Joshua Oliver, Nov 27 2019

Keywords

Comments

All numbers appear in this sequence. The number of 1's in the n-th Mersenne number (A000225) is n and the number of 0's in the n-th Mersenne number is 0. 0+n=n. See formula.

Examples

			   n [binary n ]  A087117(n) + A038374(n) = a(n)
   0 [       0 ]  1          + 0          = 1
   1 [       1 ]  0          + 1          = 1
   2 [     1 0 ]  1          + 1          = 2
   3 [     1 1 ]  0          + 2          = 2
   4 [   1 0 0 ]  2          + 1          = 3
   5 [   1 0 1 ]  1          + 1          = 2
   6 [   1 1 0 ]  1          + 2          = 3
   7 [   1 1 1 ]  0          + 3          = 3
   8 [ 1 0 0 0 ]  3          + 1          = 4
   9 [ 1 0 0 1 ]  2          + 1          = 3
  10 [ 1 0 1 0 ]  1          + 1          = 2
  11 [ 1 0 1 1 ]  1          + 2          = 3
  12 [ 1 1 0 0 ]  2          + 2          = 4
  13 [ 1 1 0 1 ]  1          + 2          = 3
  14 [ 1 1 1 0 ]  1          + 3          = 4
  15 [ 1 1 1 1 ]  0          + 4          = 4
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L;
      L:= convert(n,base,2);
      max(map(nops,[ListTools:-Split(`=`,L,1)]))+max(map(nops,[ListTools:-Split(`=`,L,0)]))
    end proc:
    map(f, [$0..100]); # Robert Israel, Apr 06 2020
  • Mathematica
    Table[Sum[Max[Differences[Position[Flatten@{k,IntegerDigits[n,2],k},k]]],{k,0,1}]-2,{n,0,82}]

Formula

a(n) = A087117(n) + A038374(n).
a(A000225(n)) = n for n > 0.

A090047 Length of longest contiguous block of 0's in binary expansion of n^2.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := If[n <= 1, 1-n, Max[Length /@ Split[IntegerDigits[n^2, 2]][[2 ;; -1 ;; 2]]]]; Array[a, 100, 0] (* Amiram Eldar, Jul 28 2025 *)

Formula

a(n) = A087117(A000290(n)).

A090048 Length of longest contiguous block of 0's in binary expansion of n-th triangular number.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{d = IntegerDigits[n*(n + 1)/2, 2]}, If[! MemberQ[d, 0], 0, Max[Length /@ Split[d][[2 ;; -1 ;; 2]]]]]; a[0] = 1; Array[a, 102, 0] (* Amiram Eldar, Jul 29 2025 *)

Formula

a(n) = A087117(A000217(n)).

A090049 Length of longest contiguous block of 0's in binary expansion of n^3.

Original entry on oeis.org

1, 0, 3, 1, 6, 1, 3, 1, 9, 2, 3, 2, 6, 3, 3, 2, 12, 3, 3, 2, 6, 4, 3, 4, 9, 4, 3, 3, 6, 3, 3, 3, 15, 4, 3, 2, 6, 3, 3, 2, 9, 4, 4, 2, 6, 3, 4, 3, 12, 3, 4, 6, 6, 3, 3, 3, 9, 2, 3, 4, 6, 2, 3, 4, 18, 5, 4, 2, 6, 6, 3, 4, 9, 2, 3, 2, 6, 1, 3, 4, 12, 6, 4, 3, 6, 2, 3, 5, 9, 5, 3, 3, 6, 6, 3, 3, 15, 4, 3
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Crossrefs

Programs

  • Maple
    f:= proc(n) local R;
      R:= convert(2*n^3+1,base,2);
      R:= select(t -> R[t]=1, [$1..nops(R)]);
      max(R[2..-1]-R[1..-2])-1
    end proc:
    f(0):= 1:
    map(f, [$0..100]); # Robert Israel, Mar 10 2020
  • Mathematica
    a[n_] := Module[{d = IntegerDigits[n^3, 2]}, If[! MemberQ[d, 0], 0, Max[Length /@ Split[d][[2 ;; -1 ;; 2]]]]]; a[0] = 1; Array[a, 102, 0] (* Amiram Eldar, Jul 29 2025 *)
  • PARI
    a(n)=my(r,k,t=n^3); for(i=0,exponent(t), if(bittest(t,i), k=0, k++>r, r=k)); if(n, r, 1) \\ Charles R Greathouse IV, Mar 10 2020

Formula

a(n) = A087117(A000578(n)).
a(n) <= 3*A070939(n) - 3 for n > 0. - Charles R Greathouse IV, Mar 10 2020
a(n) >= 3*A007814(n). Conjecture: if n < 2^k then a(n) < 3*k. - Robert Israel, Mar 10 2020

A090046 Length of longest contiguous block of 0's in binary expansion of n-th prime.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Length[ Union[ DeleteCases[ Split[ IntegerDigits[n, 2]], 1, 2]][[ -1]]]; Table[ f[ Prime[n]], {n, 1, 105}] (* Robert G. Wilson v, Dec 03 2003 *)

Formula

a(n) = A087117(A000040(n)).

A144789 Consider the runs of 0's in the binary representation of n, each of these runs being on the edge of the binary representation n and/or being bounded by 1's. a(n) = the length of the shortest such run (with positive length) of 0's in binary n. a(n) = 0 if there are no runs of 0's in binary n.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Sep 21 2008

Keywords

Examples

			20 in binary is 10100. The runs of 0's are as follows: 1(0)1(00). The shortest of these runs contains exactly one 0's So a(20) = 1.
		

Crossrefs

Programs

  • Maple
    A007814 := proc(n) local nshf,a ; a := 0 ; nshf := n ; while nshf mod 2 = 0 do nshf := nshf/2 ; a := a+1 ; od: a ; end: A144789 := proc(n) option remember ; local lp2,lp2sh,bind ; bind := convert(n,base,2) ; if add(i,i=bind) = nops(bind) then RETURN(0) ; fi; lp2 := A007814(n) ; if lp2 = 0 then A144789(floor(n/2)) ; else lp2sh := A144789(n/2^lp2) ; if lp2sh = 0 then lp2 ; else min(lp2,lp2sh) ; fi; fi; end: for n from 1 to 140 do printf("%d,",A144789(n)) ; od: # R. J. Mathar, Sep 29 2008
  • Mathematica
    Table[Min[Length/@Select[Split[IntegerDigits[n,2]],MemberQ[#,0]&]],{n,120}]/.\[Infinity]->0 (* Harvey P. Dale, Jul 24 2016 *)

Extensions

Extended by R. J. Mathar, Sep 29 2008

A330166 Length of the longest run of 0's in the ternary expression of n.

Original entry on oeis.org

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

Views

Author

Joshua Oliver, Dec 04 2019

Keywords

Comments

All numbers appear in this sequence. The n-th power of 3 (A000244(n)) has n 0's in its ternary expression.
The longest run of zeros possible in this sequence is 2, as the last digit of the ternary expression of the integers cycles between 0, 1, and 2, meaning that at least one of three consecutive numbers has a 0 in its ternary expression.

Examples

			For n = 87, the ternary expression of 87 is 10020. The length of the runs of 0's in the ternary expression of 87 are 2 and 1, respectively. The larger of these two values is 2, so a(87) = 2.
   n [ternary n] a(n)
   0 [        0] 1
   1 [        1] 0
   2 [        2] 0
   3 [      1 0] 1
   4 [      1 1] 0
   5 [      1 2] 0
   6 [      2 0] 1
   7 [      2 1] 0
   8 [      2 2] 0
   9 [    1 0 0] 2
  10 [    1 0 1] 1
  11 [    1 0 2] 1
  12 [    1 1 0] 1
  13 [    1 1 1] 0
  14 [    1 1 2] 0
  15 [    1 2 0] 1
  16 [    1 2 1] 0
  17 [    1 2 2] 0
  18 [    2 0 0] 2
  19 [    2 0 1] 1
  20 [    2 0 2] 1
		

Crossrefs

Equals zero iff n is in A032924.

Programs

  • Mathematica
    Table[Max@FoldList[If[#2==0,#1+1,0]&,0,IntegerDigits[n,3]],{n,0,90}]

Formula

a(A000244(n)) = a(3^n) = n.
a(n) = 0 iff n is in A032924.

A333767 Length of shortest run of zeros after a one in the binary expansion of n. a(0) = 0.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Apr 06 2020

Keywords

Examples

			The binary expansion of 148 is (1,0,0,1,0,1,0,0), so a(148) = 1.
		

Crossrefs

Positions of first appearances (ignoring index 0) are A000079.
Positions of terms > 0 are A022340.
Minimum prime index is A055396.
The maximum part minus 1 is given by A087117.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Compositions without 1's are A022340.
- Sum is A070939.
- Product is A124758.
- Runs are counted by A124767.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Runs-resistance is A333628.
- Maximum is A333766.
- Minimum is A333768.
- Weakly decreasing compositions are A114994.
- Weakly increasing compositions are A225620.
- Strictly decreasing compositions are A333255.
- Strictly increasing compositions are A333256.

Programs

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

Formula

For n > 0, a(n) = A333768(n) - 1.

A218076 Indices of positive Fibonacci numbers whose binary expansions have record numbers of consecutive zeros.

Original entry on oeis.org

3, 6, 12, 19, 38, 42, 68, 243, 384, 515, 740, 1709, 5151, 11049, 45641, 94729, 185610, 644593, 726681, 2296396, 3098358, 6178778, 15743325, 22436908, 80141430, 84300971, 127495932, 177416979, 198423144, 275354607
Offset: 1

Views

Author

Peter Polm, Oct 20 2012

Keywords

Comments

Positions of records in the auxiliary sequence 0, 0, 0, 1, 0, 1, 3, 1, 1, 3, 1, 2, 4, 2, 2, 3, 1, 3, 4, 5, 2,... = A087117(Fibonacci(n)). - R. J. Mathar, Nov 05 2012

Examples

			The first four records occur at 3, 6, 12, and 19:
F(3) = 10_2 (one zero),
F(6) = 1000_2 (three zeros),
F(12) = 10010000_2 (four zeros), and
F(19) = 1000001010101_2 (five zeros).
For the n=6178778, F(6178778) has 43 consecutive zeros.
		

Crossrefs

Extensions

More terms from Peter Polm's web site, Joerg Arndt, Aug 18 2014
Previous Showing 11-19 of 19 results.