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.

A213629 In binary representation: T(n,k) = number of (possibly overlapping) occurrences of k in n, triangle read by rows, 1<=k<=n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jun 17 2012

Keywords

Comments

The definition is based on the definition of pattern functions in the paper of Allouche and Shallit;
sum of n-th row = A029931(n);
T(n,1) = A000120(n);
T(n,2) = A033264(n) for n > 1;
T(n,3) = A014081(n) for n > 2;
T(n,4) = A056978(n) for n > 3;
T(n,5) = A056979(n) for n > 4;
T(n,6) = A056980(n) for n > 5;
T(n,7) = A014082(n) for n > 6;
T(n,k) = 0 for k with floor(n/2) < k < n;
T(n,n) = 1;
A122953(n) = Sum_{k=1..n} A057427(T(n,k));
A005811(n) = T(n,1) + T(n,2) - T(n,3);
A007302(n) = A000120(n) - sum (A213629(n,A136412(k))).

Examples

			The triangle begins:
.   1:                        1
.   2:                      1   1
.   3:                    2   0   1
.   4:                  1   1   0   1
.   5:                2   1   0   0   1
.   6:              2   1   1   0   0   1
.   7:            3   0   2   0   0   0   1
.   8:          1   1   0   1   0   0   0   1
.   9:        2   1   0   1   0   0   0   0   1
.  10:      2   2   0   0   1   0   0   0   0   1
.  11:    3   1   1   0   1   0   0   0   0   0   1
.  12:  2   1   1   1   0   1   0   0   0   0   0   1.
		

Crossrefs

Programs

  • Haskell
    import Data.List (inits, tails, isPrefixOf)
    a213629 n k = a213629_tabl !! (n-1) !! (k-1)
    a213629_row n = a213629_tabl !! (n-1)
    a213629_tabl = map f $ tail $ inits $ tail $ map reverse a030308_tabf where
       f xss = map (\xs ->
               sum $ map (fromEnum . (xs `isPrefixOf`)) $ tails $ last xss) xss
  • Mathematica
    t[n_, k_] := (idn = IntegerDigits[n, 2]; idk = IntegerDigits[k, 2]; ln = Length[idn]; lk = Length[idk]; For[cnt = 0; i = 1, i <= ln - lk + 1, i++, If[idn[[i ;; i + lk - 1]] == idk, cnt++]]; cnt); Table[t[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Oct 22 2012 *)

A072219 Any number n can be written uniquely in the form n = 2^k_1 - 2^k_2 + 2^k_3 - ... + 2^k_{2r+1} where the signs alternate, there are an odd number of terms, and k_1 > k_2 > k_3 > ... > k_{2r+1} >= 0; sequence gives number of terms 2r+1.

Original entry on oeis.org

1, 1, 3, 1, 3, 3, 3, 1, 3, 3, 5, 3, 3, 3, 3, 1, 3, 3, 5, 3, 5, 5, 5, 3, 3, 3, 5, 3, 3, 3, 3, 1, 3, 3, 5, 3, 5, 5, 5, 3, 5, 5, 7, 5, 5, 5, 5, 3, 3, 3, 5, 3, 5, 5, 5, 3, 3, 3, 5, 3, 3, 3, 3, 1, 3, 3, 5, 3, 5, 5, 5, 3, 5, 5, 7, 5, 5, 5, 5, 3, 5, 5, 7, 5, 7, 7, 7, 5, 5, 5, 7, 5, 5, 5, 5, 3, 3, 3, 5, 3, 5, 5, 5, 3, 5
Offset: 1

Views

Author

N. J. A. Sloane, Jul 05 2002

Keywords

Comments

2^k_1 is smallest power of 2 that is >= n.
The first Mathematica program computes the sequence for numbers 1 to 2^m. - T. D. Noe, Jul 15 2002
a(A000079(n)) = 1; a(A238246(n)) = 3; a(A238247(n)) = 5; a(A238248(n)) = 7. - Reinhard Zumkeller, Feb 20 2014
Add 1 to every other terms of A005811. - N. J. A. Sloane, Jan 14 2017

Examples

			1=1, 2=2, 3=4-2+1, 4=4, 5=8-4+1, 6=8-4+2, ...
		

References

  • P. Bachmann, Niedere Zahlentheorie (1902, 1910), reprinted Chelsea, NY, 1968, vol. 2, pp. 61-62.

Crossrefs

Programs

  • Haskell
    a072219 = (+ 1) . (* 2) . a033264 . subtract 1
    -- Reinhard Zumkeller, Feb 20 2014
  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]; sumit[s_List] := Module[{i, ss=0}, Do[If[OddQ[i], ss+=s[[i]], ss-=s[[i]]], {i, Length[s]}]; ss]; m=8; powers=Table[2^i, {i, 0, m}]; lst=Table[0, {2^m}]; sets={}; Do[sets=Union[sets, KSubsets[powers, i]], {i, 1, m+1, 2}]; Do[t=sets[[i]]; lst[[sumit[t]]]=Length[t], {i, Length[sets]}]; lst
    (* second program *)
    a[n_] := 2 Count[Split[IntegerDigits[n-1, 2], #1 == 1 && #2 == 0 &], {1, 0} ] + 1; Array[a, 105] (* Jean-François Alcover, Apr 01 2016 *)

Formula

G.f.: 1/(1+x) + (1/(1-x)) * Sum_{r>=0} x^(2^r) / (1+x^(2^(r+1))). - Ramasamy Chandramouli, Dec 22 2012

Extensions

More terms from T. D. Noe, Jul 15 2002

A175047 Write n in binary, then increase each run of 0's by one 0. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

1, 4, 3, 8, 9, 12, 7, 16, 17, 36, 19, 24, 25, 28, 15, 32, 33, 68, 35, 72, 73, 76, 39, 48, 49, 100, 51, 56, 57, 60, 31, 64, 65, 132, 67, 136, 137, 140, 71, 144, 145, 292, 147, 152, 153, 156, 79, 96, 97, 196, 99, 200, 201, 204, 103, 112, 113, 228, 115, 120, 121, 124, 63, 128
Offset: 1

Views

Author

Leroy Quet, Dec 02 2009

Keywords

Comments

From Reinhard Zumkeller, Dec 12 2009: (Start)
A070939(a(n)) = A070939(n) + A033264(n);
A171598 and A171599 give record values and where they occur. (End)

Examples

			12 in binary is 1100. Increase each run of 0 by one digit to get 11000, which is 24 in decimal. So a(12) = 24.
		

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a175047 = foldr (\b v -> 2 * v + b) 0 . concatMap
       (\bs@(b:_) -> if b == 0 then 0 : bs else bs) . group . a030308_row
    -- Reinhard Zumkeller, Jul 05 2013
    
  • Mathematica
    f[n_] := Block[{s = Split@ IntegerDigits[n, 2]}, FromDigits[ Flatten@ Insert[s, {0}, Table[{2 i}, {i, Floor[ Length@s/2]} ]], 2]]; Array[ f, 64] (* Robert G. Wilson v, Dec 11 2009 *)
  • Python
    from re import split
    def A175047(n):
      return int(''.join(d+'0' if '0' in d else d for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2) # Chai Wah Wu, Nov 21 2018

Formula

a(n) = if n<2 then n else 2*(1 + 0^((n+2) mod 4))*a([n/2]) + n mod 2. - Reinhard Zumkeller, Jan 20 2010
a(2^n) = 2^(n+1). - Chai Wah Wu, Nov 21 2018

Extensions

Extended by Ray Chandler, Dec 18 2009
a(11) onwards from Robert G. Wilson v and Reinhard Zumkeller, Dec 11 2009

A196521 Decimal expansion of Pi/4-log(2)/2.

Original entry on oeis.org

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

Views

Author

R. J. Mathar, Oct 03 2011

Keywords

Examples

			0.438824573117475654907044785090787437011542282663648828183396143330257...
		

References

  • L. B. W. Jolley, Summation of series, Dover Publications Inc., New York, 1961, p. 14 (eq. 72).

Crossrefs

Cf. A003881, A016655 (10*log(2)/2), A033264.
Cf. A231902 (Pi/4+log(2)/2), A342316.

Programs

Formula

Equals 1 - 1/2 - 1/3 + 1/4 + 1/5 - ....
Equals Sum_{n>=0} 2/((4*n+2)*(4*n+3)). - Peter Luschny, Dec 06 2013
Equals Sum_{n>=1} (-1)^(n+1)/((2*n-1)*(2*n)). - Robert FERREOL, Dec 14 2015
Equals Integral_{x=0..1} (arctan(x)) dx = Integral_{x=0..Pi/4} (x / cos(x)^2) dx = Integral_{x=0..1/sqrt(2)} (arcsin(x)/(1-x^2)^(3/2)) dx. - Robert FERREOL, Dec 14 2015
Equals Integral_{x>=0} (exp(x) - 1)/(exp(2*x) + 1) dx. - Peter Bala, Nov 01 2019
From Bernard Schott, Sep 07 2020: (Start)
Equals Sum_{n>=1} (-1)^(n*(n-1)/2) / n [compare with A231902 formula].
Equals Sum_{n>=0} (8*n+5) / (4*(n+1)*(2*n+1)*(4*n+1)*(4*n+3)). (End)
Equals Sum_{k>=1} A033264(k)/(k*(k+1)) (Allouche and Shallit, 1990). - Amiram Eldar, Jun 01 2021
From Peter Bala, Mar 04 2025: (Start)
Equals (1/2) * A342316.
Equals Integral_{x = 0..1} x/(x^2 - 2*x + 2) = Integral_{x = 0..1} x*(1 + x)/(2 - x^2*(1 - x)) dx.
Equals (5/2)*Sum_{n >= 1} 1/(n*binomial(3*n, n)*2^n). The first 10 terms of the series gives the approximate value 0.43882457311(68...), correct to 11 decimal places. (End)

A384715 a(n) = Sum_{k=0..n} (binomial(n, k) mod 4).

Original entry on oeis.org

1, 2, 4, 8, 4, 8, 12, 16, 4, 8, 12, 24, 12, 24, 24, 32, 4, 8, 12, 24, 12, 24, 32, 48, 12, 24, 32, 48, 24, 48, 48, 64, 4, 8, 12, 24, 12, 24, 32, 48, 12, 24, 32, 64, 32, 64, 64, 96, 12, 24, 32, 48, 32, 64, 64, 96, 24, 48, 64, 96, 48, 96, 96, 128, 4, 8, 12, 24
Offset: 0

Views

Author

David Radcliffe, Jun 23 2025

Keywords

Comments

This is a 2-automatic sequence.

Examples

			Let b(n) be the binary expansion of n. Then a(n) = (1 + p10 + p11) * 2^c, where c is the number of set bits in b(n), p10 is the number of '10' patterns in b(n), and p11 is 1 or 0 depending on whether the pattern '11' is occurring in b(n) or not. This formula is used by _Chai Wah Wu_ in the Python function below. For instance:
  n = 25 -> b(n) = 11001 -> a(n) = (1+1+1) * 2^3 = 24.
  n = 26 -> b(n) = 11010 -> a(n) = (1+2+1) * 2^3 = 32.
  n = 27 -> b(n) = 11011 -> a(n) = (1+1+1) * 2^4 = 48.
- _Peter Luschny_, Jun 25 2025
		

Crossrefs

Cf. A001316, A014081, A033264, A051638 (mod 3 analog), A085357. Row sums of triangle A034931.

Programs

  • Mathematica
    A384715[n_] := 2^DigitSum[n, 2]*(StringCount[IntegerString[n, 2], "10"] - Boole[BitAnd[n,2*n] == 0] + 2);
    Array[A384715, 100, 0] (* Paolo Xausa, Jun 26 2025 *)
  • PARI
    a(n) = sum(k=0, n, binomial(n,k)%4); \\ Michel Marcus, Jun 25 2025
  • Python
    def A001316(n): return (1 + (n % 2)) * A001316(n // 2) if n else 1
    def A033264(n): return (n % 4 == 2) + A033264(n // 2) if n else 0
    def A085357(n): return int(n & (n<<1) == 0)
    def A384715(n): return A001316(n) * (A033264(n) - A085357(n) + 2)
    
  • Python
    def A384715(n): return (((n>>1)&~n).bit_count()+bool(n&(n<<1))+1)<Chai Wah Wu, Jun 25 2025
    
  • Python
    def a(n: int) -> int:  # after Chai Wah Wu
        b = bin(n)[2:]; p = b.count("10"); q = b.count("11")
        return (p + (2 if q else 1)) * 2**n.bit_count()  # Peter Luschny, Jun 25 2025
    

Formula

a(n) = A001316(n) * (A033264(n) - A085357(n) + 2) for n > 0.
Recurrences:
a(4n) = a(2n),
a(4n+1) = 2a(2n),
a(8n+2) = a(4n+2) + 2a(2n) - a(2n+1),
a(8n+3) = a(4n+3) + 4a(2n) - 4a(n),
a(8n+6) = a(4n+3) + 2a(4n+2) - 2a(2n+1),
a(8n+7) = 2a(4n+3).

A163000 Count of integers x in [0,n] satisfying A000120(x) + A000120(n-x) = A000120(n) + 1.

Original entry on oeis.org

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

Views

Author

Vladimir Shevelev, Jul 20 2009

Keywords

Comments

For every solution x, binomial(n,x) is 2 times an odd integer.
A generalization: for every solution 0 <= x <= n of the equation A000120(x) + A000120(n-x) = A000120(n) + r, binomial(n,x) is 2^r times an odd integer.
Apparently this is also the number of 2's in the n-th row of A034931. - R. J. Mathar, Jul 28 2017

Crossrefs

A001316 and A163577 count binomial coefficients with 2-adic valuation 0 and 2. A275012 gives a measure of complexity of these sequences. - Eric Rowland, Mar 15 2017

Programs

  • Maple
    A163000 := proc(n) local a,x; a := 0 ; for x from 0 to n do if A000120(x)+A000120(n-x) = A000120(n)+1 then a := a+1; fi; od: a; end:
    seq(A163000(n),n=0..100) ; # R. J. Mathar, Jul 21 2009
  • Mathematica
    okQ[x_, n_] := DigitCount[x, 2, 1] + DigitCount[n - x, 2, 1] == DigitCount[n, 2, 1] + 1; a[n_] := Count[Range[0, n], x_ /; okQ[x, n]]; Table[a[n], {n, 0, 92}] (* Jean-François Alcover, Jul 13 2017 *)
  • PARI
    a(n) = my(z=hammingweight(n)+1); sum(x=0, n, hammingweight(x) + hammingweight(n-x) == z); \\ Michel Marcus, Jun 06 2021

Formula

a(n)=0 iff n=2^k-1, k>=0. a(n)=1 iff n=2^k, k>=1.
Conjecture: a(n) = A033264(n)* 2^(A000120(n)-1); from [Davis & Webb]. - R. J. Mathar, Jul 28 2017

Extensions

Extended beyond a(22) by R. J. Mathar, Jul 21 2009

A056973 Number of blocks of {0,0} in the binary expansion of n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a056973 = f 0 where
       f y x = if x == 0 then y else f (y + 0 ^ (mod x 4)) $ div x 2
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Maple
    f:= proc(n) option remember;
         if n mod 4 = 0 then 1 + procname(n/2)
         else procname(floor(n/2))
         fi
    end proc:
    f(1):= 0:
    map(f, [$1..200]); # Robert Israel, Sep 02 2015
  • Mathematica
    f[n_] := Count[Partition[IntegerDigits[n, 2], 2, 1], {0, 0}]; Table[f@ n, {n, 0, 102}] (* Michael De Vlieger, Sep 01 2015, after Robert G. Wilson v at A014081 *)
    SequenceCount[#,{0,0},Overlaps->True]&/@(IntegerDigits[#,2]&/@Range[0,120]) (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 24 2018 *)
  • PARI
    a(n) = { my(x = bitor(n, n>>1));
             if (x == 0, 0, 1 + logint(x, 2) - hammingweight(x)) }
    vector(102, i, a(i))  \\ Gheorghe Coserea, Sep 01 2015

Formula

a(2n) = a(n) + [n is even], a(2n+1) = a(n).
G.f.: 1/(1-x) * Sum_{k>=0} t^4/((1+t)*(1+t^2)) where t=x^(2^k). - Ralf Stephan, Sep 10 2003
a(n) = A023416(n) - A033264(n). - Ralf Stephan, Sep 10 2003
Sum_{n>=1} a(n)/(n*(n+1)) = 2 - 3*log(2)/2 - Pi/4 (Allouche and Shallit, 1990). - Amiram Eldar, Jun 01 2021

A324345 Lexicographically earliest positive sequence such that a(i) = a(j) => A005811(i) = A005811(j) and A278222(i) = A278222(j), for all i, j >= 0.

Original entry on oeis.org

1, 2, 3, 4, 3, 5, 6, 7, 3, 5, 8, 9, 6, 9, 10, 11, 3, 5, 8, 9, 8, 12, 13, 14, 6, 9, 13, 15, 10, 14, 16, 17, 3, 5, 8, 9, 8, 12, 13, 14, 8, 12, 18, 19, 13, 19, 20, 21, 6, 9, 13, 15, 13, 19, 22, 23, 10, 14, 20, 23, 16, 21, 24, 25, 3, 5, 8, 9, 8, 12, 13, 14, 8, 12, 18, 19, 13, 19, 20, 21, 8, 12, 18, 19, 18, 26, 27, 28, 13, 19, 27, 29, 20, 28, 30, 31, 6, 9, 13, 15, 13, 19
Offset: 0

Views

Author

Antti Karttunen, Feb 24 2019

Keywords

Comments

Restricted growth sequence transform of the ordered pair [A005811(n), A278222(n)], or equally, of [A005811(n), A286622(n)].
For all i, j >= 1:
a(i) = a(j) => A033264(i) = A033264(j).

Crossrefs

Programs

  • PARI
    up_to = 65537;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A005811(n) = hammingweight(bitxor(n, n>>1)); \\ From A005811
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t };
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    A278222(n) = A046523(A005940(1+n));
    Aux324345(n) = [A005811(n), A278222(n)];
    v324345 = rgs_transform(vector(1+up_to,n,Aux324345(n-1)));
    A324345(n) = v324345[1+n];

Formula

a(2^n) = 3 for all n >= 1.

A382723 Number of entries in the n-th row of Pascal's triangle not divisible by 4.

Original entry on oeis.org

1, 2, 3, 4, 3, 6, 6, 8, 3, 6, 8, 12, 6, 12, 12, 16, 3, 6, 8, 12, 8, 16, 16, 24, 6, 12, 16, 24, 12, 24, 24, 32, 3, 6, 8, 12, 8, 16, 16, 24, 8, 16, 20, 32, 16, 32, 32, 48, 6, 12, 16, 24, 16, 32, 32, 48, 12, 24, 32, 48, 24, 48, 48, 64, 3, 6, 8, 12, 8, 16, 16, 24, 8, 16, 20, 32, 16, 32, 32, 48, 8
Offset: 0

Views

Author

N. J. A. Sloane, Apr 23 2025

Keywords

Crossrefs

Programs

  • PARI
    a(n) = sum(k=0, n, (binomial(n, k) % 4) != 0); \\ Michel Marcus, Apr 23 2025
    
  • Python
    def A382723(n): return bin(n)[2:].count('10')+2<Chai Wah Wu, Aug 10 2025

Formula

a(n) = (A033264(n)+2)*2^(A000120(n)-1). - Chai Wah Wu, Aug 10 2025
Previous Showing 11-19 of 19 results.