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

A239904 a(n) = n - wt(n) + (number of times 11 appears in binary expansion of n).

Original entry on oeis.org

0, 0, 1, 2, 3, 3, 5, 6, 7, 7, 8, 9, 11, 11, 13, 14, 15, 15, 16, 17, 18, 18, 20, 21, 23, 23, 24, 25, 27, 27, 29, 30, 31, 31, 32, 33, 34, 34, 36, 37, 38, 38, 39, 40, 42, 42, 44, 45, 47, 47, 48, 49, 50, 50, 52, 53, 55, 55, 56, 57, 59, 59, 61, 62, 63, 63, 64, 65, 66, 66, 68, 69, 70, 70, 71, 72, 74, 74, 76
Offset: 0

Views

Author

N. J. A. Sloane, Apr 06 2014

Keywords

Comments

This is G_{2, 1/4}(n) in Prodinger's notation.

Crossrefs

Programs

  • Maple
    A000120 := proc(n) add(i, i=convert(n, base, 2)) end:
    # A014081:
    cn := proc(v, k) local n, s, nn, i, j, som, kk;
    som := 0;
    kk := convert(cat(seq(1, j = 1 .. k)),string);
    n := convert(v, binary);
    s := convert(n, string);
    nn := length(s);
    for i to nn - k + 1 do
    if substring(s, i .. i + k - 1) = kk then som := som + 1 fi od;
    som; end;
    [seq(n-A000120(n)+cn(n,2), n=0..100)];
  • Mathematica
    cn[n_, k_] := Count[Partition[IntegerDigits[n, 2], k, 1], Table[1, {k}]]; Table[n - DigitCount[n, 2, 1] + cn[n, 2], {n, 0, 78}] (* Michael De Vlieger, Sep 18 2015 *)
  • PARI
    a(n) = n - hammingweight(n) + hammingweight(bitand(n, n>>1));
    vector(79, i, a(i-1))  \\ Gheorghe Coserea, Sep 24 2015
    
  • Python
    def A239904(n): return n-n.bit_count()+(n&(n>>1)).bit_count() # Chai Wah Wu, Feb 12 2023

Formula

a(n) = n - A000120(n) + A014081(n).

A257739 Numbers n for which A256999(n) > n; numbers that can be made larger by rotating (by one or more steps) the non-msb bits of their binary representation (with A080541 or A080542).

Original entry on oeis.org

5, 9, 10, 11, 13, 17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 53, 54, 55, 57, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99, 101, 102, 103, 105, 107, 108, 109, 110, 111
Offset: 1

Views

Author

Antti Karttunen, May 18 2015

Keywords

Comments

Note that A256999(a(n)) is always in A257250.
If we define a co-necklace to be a finite sequence that is lexicographically maximal (not minimal) among all of its cyclic rotations, these are numbers whose binary expansion, without the most significant digit, is not a co-necklace. Numbers whose binary expansion, without the most significant digit, is not a necklace are A329367. - Gus Wiseman, Nov 14 2019

Examples

			For n = 5 with binary representation "101" if we rotate other bits than the most significant bit (that is, only the two rightmost digits "01") one step to either direction we get "110" = 6 > 5, so 5 can be made larger by such rotations and thus 5 is included in this sequence.
For n = 6 with binary representation "110" no such rotation will yield a larger number and thus 6 is NOT included in this sequence.
For n = 10 with binary representation "1010" if we rotate other bits than the most significant bit (that is, only the three rightmost digits "010") either one step to the left or two steps to the right we get "1100" = 12 > 10, thus 10 is included in this sequence.
		

Crossrefs

Complement: A257250.
Numbers whose binary expansion is a necklace are A275692.
Numbers whose binary expansion is a co-necklace are A065609.
Numbers whose reversed binary expansion is a necklace are A328595.
Numbers whose non-msb expansion is a co-necklace are A257250.
Numbers whose non-msb expansion is a necklace are A328668.
Numbers whose reversed non-msb expansion is a necklace are A328607.
Numbers whose non-msb expansion is not a necklace are A329367.
Binary necklaces are A000031.
Necklace compositions are A008965.

Programs

  • Mathematica
    reckQ[q_]:=Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
    Select[Range[2,100],!reckQ[Rest[IntegerDigits[#,2]]]&] (* Gus Wiseman, Nov 14 2019 *)

A051032 Summatory Rudin-Shapiro sequence for 2^(n-1).

Original entry on oeis.org

2, 3, 3, 5, 5, 9, 9, 17, 17, 33, 33, 65, 65, 129, 129, 257, 257, 513, 513, 1025, 1025, 2049, 2049, 4097, 4097, 8193, 8193, 16385, 16385, 32769, 32769, 65537, 65537, 131073, 131073, 262145, 262145, 524289, 524289, 1048577, 1048577, 2097153
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    d2n[n_]:=Module[{x=2^n+1},{x,x}];Join[{2},Flatten[Array[d2n,30]]] (* Harvey P. Dale, May 26 2011 *)

Formula

Apart from leading term, just A000051 (2^n + 1) doubled up.
G.f.: -x*(-2 - x + 4*x^2)/((x - 1)*(2*x^2 - 1)). - R. J. Mathar, Jul 15 2016
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3). - Wesley Ivan Hurt, Aug 19 2022
E.g.f.: cosh(x) + cosh(sqrt(2)*x) + sinh(x) + sinh(sqrt(2)*x)/sqrt(2) - 2. - Stefano Spezia, Feb 05 2023

A056966 In binary: write what is described (putting a leading zero on numbers which have an odd number of binary digits).

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Jul 20 2000

Keywords

Examples

			a(54)=2 because 54 = 110110 base 2, which can be read as one 1 followed by zero 1's followed by one 0, i.e., 10 base 2 = 2 base 10.
		

Crossrefs

Programs

  • Python
    def A056966(n):
        s = bin(n)[2:]
        s = '0'*(len(s)&1)+s
        return int('0'+''.join(s[i+1]*int(s[i])for i in range(0,len(s),2)),2) # Chai Wah Wu, Feb 12 2023

A100046 Decimal expansion of -Pi/4 + (3*log(2))/2.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Oct 31 2004

Keywords

Examples

			0.2543226074...
		

Crossrefs

Programs

  • Mathematica
    RealDigits[(3*Log[2])/2-Pi/4,10,120][[1]] (* Harvey P. Dale, May 28 2018 *)

Formula

Equals Sum_{k>=1} A014081(k)/(k*(k+1)) (Allouche and Shallit, 1990). - Amiram Eldar, Jun 01 2021

A196096 Occurrences of '11' in base 3 expansion of n.

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Sep 27 2011

Keywords

Comments

Occurrences of '11' in A007089(n). This is to base 3 and A007089 as A014081 is to base 2 A007088.
First occurrence of k>0 = 4, 13, 40, 121, 364, ..., = A003462(k). - Robert G. Wilson v, Sep 27 2011

Examples

			a(4) = 1 because 4 in base 3 is "11" which has one instance of "11".
a(13) = 2 because the number 13 in base 3 is "111" which has two substrings of "11".
		

Crossrefs

Programs

  • Maple
    A196096 := proc(n)
            local a,dgs3 ;
            a := 0 ;
            dgs3 := convert(n,base,3) ;
            for i from 1 to nops(dgs3)-1 do
                    if op(i,dgs3)=1 and op(i+1,dgs3)=1 then
                            a := a+1 ;
                    end if;
            end do;
            a ;
    end proc:
    seq(A196096(n),n=0..80) ; # R. J. Mathar, Sep 28 2011
  • Mathematica
    f[n_] := Count[ Partition[ IntegerDigits[ n, 3], 2, 1], {1, 1}]; Array[f, 100, 0] (* Robert G. Wilson v, Sep 27 2011 *)

A270438 a(n) is the number of entries == 1 mod 4 in row n of Pascal's triangle.

Original entry on oeis.org

1, 2, 2, 2, 2, 4, 2, 4, 2, 4, 4, 4, 2, 4, 4, 8, 2, 4, 4, 4, 4, 8, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 2, 4, 4, 4, 4, 8, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 2, 4, 4, 4, 4, 8, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 4, 8, 8
Offset: 0

Views

Author

Robert Israel, Jul 12 2016

Keywords

Comments

All entries are powers of 2.

Examples

			Row 3 of Pascal's triangle is (1,3,3,1) and has two entries == 1 (mod 4), so a(3) = 2.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,m;
      L:= convert(n,base,2);
      m:= convert(L,`+`);
      if has(L[1..-2]+L[2..-1],2) then 2^(m-1) else 2^m fi
    end proc:
    map(f, [$0..1000]);
  • Mathematica
    Count[#, 1] & /@ Table[Mod[Binomial[n, k], 4], {n, 0, 120}, {k, 0, n}] (* Michael De Vlieger, Feb 26 2017 *)
  • PARI
    a(n) = 2^(hammingweight(n) - min(hammingweight(bitand(n, n>>1)),1)) \\ Charles R Greathouse IV, Jul 13 2016
    
  • Python
    def A270438(n): return 1<>1)).bit_count() # Chai Wah Wu, Apr 24 2025

Formula

a(n) = 2^(A000120(n) - min(1, A014081(n))). [Davis & Webb]

A328870 Numbers whose lengths of runs of 1's in their reversed binary expansion are not weakly increasing.

Original entry on oeis.org

11, 19, 22, 23, 35, 38, 39, 43, 44, 45, 46, 47, 55, 67, 70, 71, 75, 76, 77, 78, 79, 83, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 103, 107, 110, 111, 131, 134, 135, 139, 140, 141, 142, 143, 147, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 163, 166, 167
Offset: 1

Views

Author

Gus Wiseman, Nov 12 2019

Keywords

Examples

			The sequence of terms together with their reversed binary expansions begins:
  11: (1101)
  19: (11001)
  22: (01101)
  23: (11101)
  35: (110001)
  38: (011001)
  39: (111001)
  43: (110101)
  44: (001101)
  45: (101101)
  46: (011101)
  47: (111101)
  55: (111011)
  67: (1100001)
  70: (0110001)
  71: (1110001)
  75: (1101001)
  76: (0011001)
  77: (1011001)
  78: (0111001)
		

Crossrefs

Complement of A328869.
The version for prime indices is A112769.
The binary expansion of n has A069010(n) runs of 1's.

Programs

  • Mathematica
    Select[Range[100],!LessEqual@@Length/@Split[Join@@Position[Reverse[IntegerDigits[#,2]],1],#2==#1+1&]&]

A014083 Occurrences of '1111' in binary expansion of n.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			a(63) = 3 as 63 = 111111 in binary and 1111 occurs three times (different occurrences may overlap). - _Antti Karttunen_, Jul 24 2017
		

Crossrefs

Programs

  • Maple
    See A014081.
  • Mathematica
    Table[SequenceCount[IntegerDigits[n,2],{1,1,1,1},Overlaps->True],{n,0,100}] (* The program uses the SequenceCount function from Mathematica version 10 *) (* Harvey P. Dale, Sep 25 2015 *)
  • PARI
    u1111(n)=my(v=binary(n)); sum(k=1,#v-3, v[k]&&v[k+1]&&v[k+2]&&v[k+3])
    
  • PARI
    a(n)=my(s,t); while(n, n>>=valuation(n,2); t=valuation(n+1,2); s+=max(t-3, 0); n>>=t); s \\ Charles R Greathouse IV, Jan 21 2016

Formula

a(2n) = a(n), a(2n+1) = a(n) + [n congruent to 7 mod 8]. - Ralf Stephan, Aug 21 2003
G.f.: 1/(1-x) * sum(k>=0, t^15(1-t)/(1-t^16), t=x^2^k). - Ralf Stephan, Sep 08 2003
a(n) <= log_2(n+1) - 3 for n >= 7. - Charles R Greathouse IV, Jan 21 2016

Extensions

Term a(0)=0 prepended and more terms from Antti Karttunen, Jul 24 2017

A196272 Number of occurrences of '11' in base-4 expansion of n.

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Sep 29 2011

Keywords

Comments

This is to base 4 A007090 as A196096 is to base 3 and A007089 as A014081 is to base 2 A007088.
Records occur at places where n = '111...11' in base b, that is n = (b^(k+1)-1)/(b-1) for some k > 0, in particular for b=4 as listed in A002450(k+1). - R. J. Mathar, Sep 30 2011

Examples

			a(21) = 2 because 21 (base 10) = 111 (base 4), whose first two digits are 1's, and whose rightmost two digits are the second substring of "11".
		

Crossrefs

Programs

  • Maple
    A196272 := proc(n)
            local a, dgs ;
            a := 0 ;
            dgs := convert(n, base, 4) ;
            for i from 1 to nops(dgs)-1 do
                    if op(i, dgs)=1 and op(i+1, dgs)=1 then
                            a := a+1 ;
                    end if;
            end do;
            a ;
    end proc:
    seq(A196272(n), n=0..100) ; # R. J. Mathar, Sep 30 2011
  • Mathematica
    Table[d = IntegerDigits[n, 4]; Count[Partition[d, 2, 1], {1, 1}], {n, 0, 100}] (* T. D. Noe, Sep 30 2011 *)
Previous Showing 31-40 of 42 results. Next