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

A062383 a(0) = 1: for n>0, a(n) = 2^floor(log_2(n)+1) or a(n) = 2*a(floor(n/2)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jun 19 2001

Keywords

Comments

Informally, write down 1 followed by 2^k 2^(k-1) times, for k = 1,2,3,4,... These are the denominators of the binary van der Corput sequence (see A030101 for the numerators). - N. J. A. Sloane, Dec 01 2019
a(n) is the denominator of the form 2^k needed to make the ratio (2n-1)/2^k lie in the interval [1-2], i.e. such ratios are 1/1, 3/2, 5/4, 7/4, 9/8, 11/8, 13/8, 15/8, 17/16, 19/16, 21/16, ... where the numerators are A005408 (The odd numbers).
Let A_n be the upper triangular matrix in the group GL(n,2) that has zero entries below the diagonal and 1 elsewhere. For example for n=4 the matrix is / 1,1,1,1 / 0,1,1,1 / 0,0,1,1 / 0,0,0,1 /. The order of this matrix as an element of GL(n,2) is a(n-1). - Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 14 2001
A006257(n)/a(n) = (0, 0.1, 0.01, 0.11, 0.001, ...) enumerates all binary fractions in the unit interval [0, 1). - Fredrik Johansson, Aug 14 2006
a(n) = maximum of row n+1 in A240769. - Reinhard Zumkeller, Apr 13 2014
This is the discriminator sequence for the odious numbers. - N. J. A. Sloane, May 10 2016
From Jianing Song, Jul 05 2025: (Start)
a(n) is the period of {binomial(N,n) mod 2: N in Z}. For the general result, see A349593.
Since the modulus (2) is a prime, the remainder of binomial(N,n) is given by Lucas's theorem. (End)

Crossrefs

Apart from the initial term, equals 2 * A053644. MASKTRANSi(A062383) seems to give a signed form of A038712. (See identities at A053644). floor_log_2 given in A054429.
Equals A003817(n)+1. Cf. A002884.
Bisection of A065285. Cf. A076877.
Equals for n>=1 the r(n) sequence of A160464. - Johannes W. Meijer, May 24 2009
Equals the r(n) sequence of A162440 for n>=1. - Johannes W. Meijer, Jul 06 2009
Discriminator of the odious numbers (A000069). - Jeffrey Shallit, May 08 2016
Column 2 of A349593. A064235 (if offset 0), A385552, A385553, and A385554 are respectively columns 3, 5, 6, and 10.

Programs

  • Haskell
    import Data.List (transpose)
    a062383 n = a062383_list !! n
    a062383_list = 1 : zs where
       zs = 2 : (map (* 2) $ concat $ transpose [zs, zs])
    -- Reinhard Zumkeller, Aug 27 2014, Mar 13 2014
    
  • Magma
    [2^Floor(Log(2,2*n+1)): n in [0..70]]; // Bruno Berselli, Mar 04 2016
    
  • Maple
    [seq(2^(floor_log_2(j)+1),j=0..127)]; or [seq(coerce1st_octave((2*j)+1),j=0..127)]; or [seq(a(j),j=0..127)];
    coerce1st_octave := proc(r) option remember; if(r < 1) then coerce1st_octave(2*r); else if(r >= 2) then coerce1st_octave(r/2); else (r); fi; fi; end;
    A062383 := proc(n)
        option remember;
        if n = 0 then
            1 ;
        else
            2*procname(floor(n/2));
        end if;
    end proc:
    A062383 := n -> 1 + Bits:-Iff(n, n):
    seq(A062383(n), n=0..69); # Peter Luschny, Sep 23 2019
  • Mathematica
    a[n_] := a[n] = 2 a[n/2 // Floor]; a[0] = 1; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Mar 04 2016 *)
    Table[2^Floor[Log2[n] + 1], {n, 0, 20}] (* Eric W. Weisstein, Nov 17 2017 *)
    2^Floor[Log2[Range[0, 20]] + 1] (* Eric W. Weisstein, Nov 17 2017 *)
    2^BitLength[Range[0, 100]] (* Paolo Xausa, Jan 29 2025 *)
  • PARI
    { a=1; for (n=0, 1000, write("b062383.txt", n, " ", a*=ceil((n + 1)/a)) ) } \\ Harry J. Smith, Aug 06 2009
    
  • PARI
    a(n)=1<<(log(2*n+1)\log(2)) \\ Charles R Greathouse IV, Dec 08 2011
    
  • Python
    def A062383(n): return 1 << n.bit_length() # Chai Wah Wu, Jun 30 2022

Formula

a(1) = 1 and a(n+1) = a(n)*ceiling(n/a(n)). - Benoit Cloitre, Aug 17 2002
G.f.: 1/(1-x) * (1 + Sum_{k>=0} 2^k*x^2^k). - Ralf Stephan, Apr 18 2003
a(n) = A142151(2*n)/2 + 1. - Reinhard Zumkeller, Jul 15 2008
log(a(n))/log(2) = A029837(n+1). - Johannes W. Meijer, Jul 06 2009
a(n+1) = a(n) + A099894(n). - Reinhard Zumkeller, Aug 06 2009
a(n) = A264619(n) - A264618(n). - Reinhard Zumkeller, Dec 01 2015
a(n) is the smallest power of 2 > n. - Chai Wah Wu, Nov 04 2016
a(n) = 2^ceiling(log_2(n+1)). - M. F. Hasler, Sep 20 2017

A142150 The nonnegative integers interleaved with 0's.

Original entry on oeis.org

0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 15 2008

Keywords

Comments

Number of vertical pairs in a wheel with n equal sections. - Wesley Ivan Hurt, Jan 22 2012
Number of even terms of n-th row in the triangles A162610 and A209297. - Reinhard Zumkeller, Jan 19 2013
Also the result of writing n-1 in base 2 and multiplying the last digit with the number with its last digit removed. See A115273 and A257844-A257850 for generalization to other bases. - M. F. Hasler, May 10 2015
Also follows the rule: a(n+1) is the number of terms that are identical with a(n) for a(0..n-1). - Marc Morgenegg, Jul 08 2019

Crossrefs

Programs

Formula

a(n) = XOR{k AND (n-k): 0<=k<=n}.
a(n) = (n/2)*0^(n mod 2); a(2*n)=n and a(2*n+1)=0.
a(n) = floor(n^2/2) mod n. - Enrique Pérez Herrero, Jul 29 2009
a(n) = A027656(n-2). - Reinhard Zumkeller, Nov 05 2009
a(n) = Sum_{k=0..n} (k mod 2)*((n-k) mod 2). - Reinhard Zumkeller, Nov 05 2009
a(n+1) = A000217(n) mod A000027(n+1) = A000217(n) mod A001477(n+1). - Edgar Almeida Ribeiro (edgar.a.ribeiro(AT)gmail.com), May 19 2010
From Bruno Berselli, Oct 19 2010: (Start)
a(n) = n*(1+(-1)^n)/4.
G.f.: x^2/(1-x^2)^2.
a(n) = 2*a(n-2)-a(n-4) for n > 3.
Sum_{i=0..n} a(i) = (2*n*(n+1)+(2*n+1)*(-1)^n-1)/16 (see A008805). (End)
a(n) = -a(-n) = A195034(n-1)-A195034(-n-1). - Bruno Berselli, Oct 12 2011
a(n) = A000326(n) - A191967(n). - Reinhard Zumkeller, Jul 07 2012
a(n) = Sum_{i=1..n} floor((2*i-n)/2). - Wesley Ivan Hurt, Aug 21 2014
a(n-1) = floor(n/2)*(n mod 2), where (n mod 2) is the parity of n, or remainder of division by 2. - M. F. Hasler, May 10 2015
a(n) = A158416(n) - 1. - Filip Zaludek, Oct 30 2016
E.g.f.: x*sinh(x)/2. - Ilya Gutkovskiy, Oct 30 2016
a(n) = A000007(a(n-1)) + a(n-2) for n > 1. - Nicolas Bělohoubek, Oct 06 2024

A003817 a(0) = 0, a(n) = a(n-1) OR n.

Original entry on oeis.org

0, 1, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63
Offset: 0

Views

Author

Keywords

Comments

Also, 0+1+2+...+n in lunar arithmetic in base 2 written in base 10. - N. J. A. Sloane, Oct 02 2010
For n>0: replace all 0's with 1's in binary representation of n. - Reinhard Zumkeller, Jul 14 2003

Crossrefs

This is Guy Steele's sequence GS(6, 6) (see A135416).
Cf. A167832, A167878. - Reinhard Zumkeller, Nov 14 2009
Cf. A179526; subsequence of A007448. - Reinhard Zumkeller, Jul 18 2010
Cf. A265705.

Programs

  • Haskell
    import Data.Bits ((.|.))
    a003817 n = if n == 0 then 0 else 2 * a053644 n - 1
    a003817_list = scanl (.|.) 0 [1..] :: [Integer]
    -- Reinhard Zumkeller, Dec 08 2012, Jan 15 2012
    
  • Maple
    A003817 := n -> n + Bits:-Nand(n, n):
    seq(A003817(n), n=0..61); # Peter Luschny, Sep 23 2019
  • Mathematica
    a[0] = 0; a[n_] := a[n] = BitOr[ a[n-1], n]; Table[a[n], {n, 0, 61}] (* Jean-François Alcover, Dec 19 2011 *)
    nxt[{n_,a_}]:={n+1,BitOr[a,n+1]}; Transpose[NestList[nxt,{0,0},70]] [[2]] (* Harvey P. Dale, May 06 2016 *)
    2^BitLength[Range[0,100]]-1 (* Paolo Xausa, Feb 08 2024 *)
  • PARI
    a(n)=1<<(log(2*n+1)\log(2))-1 \\ Charles R Greathouse IV, Dec 08 2011
    
  • Python
    def a(n): return 0 if n==0 else 1 + 2*a(int(n/2)) # Indranil Ghosh, Apr 28 2017
    
  • Python
    def A003817(n): return (1<Chai Wah Wu, Jul 17 2024

Formula

a(n) = a(n-1) + n*(1-floor(a(n-1)/n)). If 2^(k-1) <= n < 2^k, a(n) = 2^k - 1. - Benoit Cloitre, Aug 25 2002
a(n) = 1 + 2*a(floor(n/2)) for n > 0. - Benoit Cloitre, Apr 04 2003
G.f.: (1/(1-x)) * Sum_{k>=0} 2^k*x^2^k. - Ralf Stephan, Apr 18 2003
a(n) = 2*A053644(n)-1 = A092323(n) + A053644(n). - Reinhard Zumkeller, Feb 15 2004; corrected by Anthony Browne, Jun 26 2016
a(n) = OR{k OR (n-k): 0<=k<=n}. - Reinhard Zumkeller, Jul 15 2008
For n>0: a(n+1) = A035327(n) + n = A035327(n) XOR n. - Reinhard Zumkeller, Nov 14 2009
A092323(n+1) = floor(a(n)/2). - Reinhard Zumkeller, Jul 18 2010
a(n) = A265705(n,0) = A265705(n,n). - Reinhard Zumkeller, Dec 15 2015
a(n) = A062383(n) - 1.
G.f. A(x) satisfies: A(x) = 2*A(x^2)*(1 + x) + x/(1 - x). - Ilya Gutkovskiy, Aug 31 2019
a(n) >= A175039(n) - Austin Shapiro, Dec 29 2022

A086099 a(n) = OR(k AND (n-k): 0<=k<=n), AND and OR bitwise.

Original entry on oeis.org

0, 0, 1, 0, 3, 2, 3, 0, 7, 6, 7, 4, 7, 6, 7, 0, 15, 14, 15, 12, 15, 14, 15, 8, 15, 14, 15, 12, 15, 14, 15, 0, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 16, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 0, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 09 2003

Keywords

Comments

a(2^n - 1) = 0, a(3*2^n - 1) = 2^n;
A086100(n) = A007088(a(n)).

Examples

			a(4) = (0 AND 4) OR (1 AND 3) OR (2 AND 2) OR (3 AND 1) OR (4 AND 0) -> (000 AND 100) OR (001 AND 011) OR (010 AND 010) OR (011 AND 001) OR (111 AND 000) = 000 OR 011 OR 010 OR 011 OR 000 = 011 -> a(4)=3.
		

Crossrefs

Cf. A003817 (even bisection), A062383.
Cf. A086100 (in binary), A007088.

Programs

  • Haskell
    import Data.Bits ((.&.), (.|.))
    a086099 n = foldl1 (.|.) $ zipWith (.&.) [0..] $ reverse [0..n] :: Integer
    -- Reinhard Zumkeller, Jun 04 2012
    
  • Mathematica
    a[n_] := BitOr @@ Table[BitAnd[k, n - k], {k, 0, n}]; Table[a[n], {n, 0, 73}] (* Jean-François Alcover, Jun 19 2012 *)
  • PARI
    a(n) = n++; 1<Kevin Ryde, Apr 11 2023

Formula

a(2*n) = 2*2^floor(log_2(n)) - 1 = A003817(n).
a(2*n+1) = 2*a(n).
a(n) = A053644(n+1) - A006519(n+1). - Ridouane Oudra, Apr 09 2023

A142149 a(n) = XOR{k OR (n-k): 0<=k<=n}.

Original entry on oeis.org

0, 1, 3, 3, 6, 5, 5, 7, 12, 9, 15, 11, 10, 13, 9, 15, 24, 17, 27, 19, 30, 21, 29, 23, 20, 25, 23, 27, 18, 29, 17, 31, 48, 33, 51, 35, 54, 37, 53, 39, 60, 41, 63, 43, 58, 45, 57, 47, 40, 49, 43, 51, 46, 53, 45, 55, 36, 57, 39, 59, 34, 61, 33, 63, 96, 65, 99, 67, 102, 69, 101, 71
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 15 2008

Keywords

Comments

a(n) = XOR{k AND (n-k): 0<=k<=n}.

Crossrefs

Programs

  • Haskell
    import Data.Bits (xor, (.|.))
    a142149 :: Integer -> Integer
    a142149 = foldl xor 0 . zipWith (.|.) [0..] . reverse . enumFromTo 1
    -- Reinhard Zumkeller, Mar 31 2015
    
  • PARI
    a(n)=if(n%2, n, bitxor(n, n/2)) \\ Charles R Greathouse IV, Jul 01 2022
  • Python
    def A142149(n): return n if n&1 else (n^ n>>1) # Chai Wah Wu, Jun 29 2022
    

Formula

a(2*n) = A048724(n) and a(2*n+1) = A005408(n).

A340632 a(n) in binary is a run of 1-bits from the most significant 1-bit of n down to the least significant 1-bit of n, inclusive.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 7, 8, 15, 14, 15, 12, 15, 14, 15, 16, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 32, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62, 63, 60, 63, 62, 63, 48, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62, 63, 60, 63, 62, 63, 64, 127, 126
Offset: 0

Views

Author

Kevin Ryde, Jan 13 2021

Keywords

Examples

			n    = 172 = binary 10101100;
a(n) = 252 = binary 11111100.
		

Crossrefs

Cf. A023758 (distinct terms).

Programs

  • PARI
    a(n) = if(n, 2<
    				
  • Python
    def a(n): return (1<
    				

Formula

a(n) = A062383(n) - A006519(n) for n>=1.
a(n) = A003817(n) - A135481(n-1).
a(n) = n + A334045(n) (filling in 0-bits, including n=0 by taking A334045(0)=0).
a(n) = A142151(n-1) + 1.
G.f.: x/(1-x) + Sum_{k>=0} 2^k*x^(2^k)*(1/(1-x) - 1/(1-x^(2^(k+1)))).
Showing 1-6 of 6 results.