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 66 results. Next

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

A261644 Distance of A260273(n) to next power of 2.

Original entry on oeis.org

1, 1, 3, 8, 5, 1, 15, 12, 9, 5, 1, 31, 28, 25, 20, 13, 8, 3, 63, 60, 57, 52, 47, 44, 41, 37, 33, 29, 24, 17, 13, 8, 3, 127, 124, 121, 116, 111, 108, 105, 99, 91, 88, 85, 81, 77, 70, 66, 62, 57, 52, 47, 40, 33, 29, 24, 15, 10, 6, 2, 254, 251, 248, 245, 239
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 30 2015

Keywords

Comments

This sequence, as well as A261712, is suggested by A261396 and A261416.

Examples

			.  1: 1
.  2: 1
.  3: 3
.  4: 8,5,1
.  5: 15,12,9,5,1
.  6: 31,28,25,20,13,8,3
.  7: 63,60,57,52,47,44,41,37,33,29,24,17,13,8,3
.  8: 127,124,121,116,111,108,105,99,91,88,85,81,77,70,... (27 terms)
.  9: 254,251,248,245,239,236,233,227,218,213,207,202,195,,... (49 terms)
		

Crossrefs

Cf. A260273, A062383, A261645 (first differences), A261712 (reversed), A261646 (row lengths).

Programs

  • Haskell
    a261644 n = a261644_list !! (n-1)
    a261644_list = zipWith (-)
                   (map a062383 a260273_list) $ map fromIntegral a260273_list
    a261644_tabf = [1] : f (tail $ zip a261645_list a261644_list) where
       f dxs = (map snd (dxs'' ++ [dx])) : f dxs' where
         (dxs'', dx:dxs') = span ((<= 0) . fst) dxs
    a261644_row n = a261644_tabf !! (n-1)

Formula

a(n) = A062383(A260273(n)) - A260273(n).

A385552 Period of {binomial(N,n) mod 5: N in Z}.

Original entry on oeis.org

1, 5, 5, 5, 5, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125
Offset: 0

Views

Author

Jianing Song, Jul 03 2025

Keywords

Comments

a(n) is the smallest power of 5 > n. For the general result, see A349593.
Since the modulus (5) is a prime, the remainder of binomial(N,n) is given by Lucas's theorem.

Examples

			For N == 0, 1, ..., 24 (mod 5), binomial(N,5) == {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4} (mod 5).
		

Crossrefs

Column 5 of A349593. A062383, A064235 (if offset 0), A385553, and A385554 are respectively columns 2, 3, 6, and 10.

Programs

  • PARI
    a(n) = if(n, 5^(logint(n,5)+1), 1)
    
  • Python
    from sympy import integer_log
    def A385552(n): return 5*5**(integer_log(n,5)[0]) if n else 1 # Chai Wah Wu, Jul 06 2025

A385553 Period of {binomial(N,n) mod 6: N in Z}.

Original entry on oeis.org

1, 6, 12, 36, 72, 72, 72, 72, 144, 432, 432, 432, 432, 432, 432, 432, 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, 2592, 2592, 2592, 2592, 2592, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184
Offset: 0

Views

Author

Jianing Song, Jul 03 2025

Keywords

Examples

			For N == 0, 1, ..., 35 (mod 36), binomial(N,3) == {0, 0, 0, 1, 4, 4, 2, 5, 2, 0, 0, 3, 4, 4, 4, 5, 2, 2, 0, 3, 0, 4, 4, 1, 2, 2, 2, 3, 0, 0, 4, 1, 4, 2, 2, 5} (mod 6).
For N == 0, 1, ..., 71 (mod 72), binomial(N,4) == {0, 0, 0, 0, 1, 5, 3, 5, 4, 0, 0, 0, 3, 1, 5, 3, 2, 4, 0, 0, 3, 3, 1, 5, 0, 2, 4, 0, 3, 3, 3, 1, 2, 0, 2, 4, 3, 3, 3, 3, 4, 2, 0, 2, 1, 3, 3, 3, 0, 4, 2, 0, 5, 1, 3, 3, 0, 0, 4, 2, 3, 5, 1, 3, 0, 0, 0, 4, 5, 3, 5, 1} (mod 6).
		

Crossrefs

Column 6 of A349593. A062383, A064235 (if offset 0), A385552, and A385554 are respectively columns 2, 3, 5, and 10.

Programs

  • PARI
    a(n) = if(n, (2^(logint(n,2)+1)) * (3^(logint(n,3)+1)), 1)

Formula

a(n) = (the smallest power of 2 > n) * (the smallest power of 3 > n) = A062383(n) * A064235(n+1). For the general result, see A349593.

A385554 Period of {binomial(N,n) mod 10: N in Z}.

Original entry on oeis.org

1, 10, 20, 20, 40, 200, 200, 200, 400, 400, 400, 400, 400, 400, 400, 400, 800, 800, 800, 800, 800, 800, 800, 800, 800, 4000, 4000, 4000, 4000, 4000, 4000, 4000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000
Offset: 0

Views

Author

Jianing Song, Jul 03 2025

Keywords

Examples

			For N == 0, 1, ..., 19 (mod 20), binomial(N,3) == {0, 0, 0, 1, 4, 0, 0, 5, 6, 4, 0, 5, 0, 6, 4, 5, 0, 0, 6, 9} (mod 10).
For N == 0, 1, ..., 39 (mod 40), binomial(N,4) == {0, 0, 0, 0, 1, 5, 5, 5, 0, 6, 0, 0, 5, 5, 1, 5, 0, 0, 0, 6, 5, 5, 5, 5, 6, 0, 0, 0, 5, 1, 5, 5, 0, 0, 6, 0, 5, 5, 5, 1} (mod 10).
		

Crossrefs

Column 10 of A349593. A062383, A064235 (if offset 0), A385552, and A385553 are respectively columns 2, 3, 5, and 6.

Programs

  • PARI
    a(n) = if(n, (2^(logint(n,2)+1)) * (5^(logint(n,5)+1)), 1)

Formula

a(n) = (the smallest power of 2 > n) * (the smallest power of 5 > n) = A062383(n) * A385552(n). For the general result, see A349593.

A083402 Let A_n be the upper triangular matrix in the group GL(n,2) that has zero entries below the main diagonal and 1 elsewhere; a(n) is the size of the conjugacy class of this matrix in GL(n,2).

Original entry on oeis.org

1, 3, 42, 2520, 624960, 629959680, 2560156139520, 41781748196966400, 2732860586067178291200, 715703393163961188325785600, 750102961052993818881476159078400, 3145391744524297920839316348340273152000, 52764474940208177704130232748554603290689536000
Offset: 1

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Jun 12 2003

Keywords

Examples

			For example for n=4 the matrix is / 1,1,1,1 / 0,1,1,1 / 0,0,1,1 / 0,0,0,1 /.
		

Crossrefs

Programs

  • Maple
    a:= n-> 2^((n-1)*(n-2)/2) *mul(2^k-1, k=1..n):
    seq(a(n), n=1..15);  # Alois P. Heinz, May 14 2013
  • Mathematica
    a[n_] := 2^((n-1)*(n-2)/2)*Product[2^k-1, {k, 1, n}]; Table[a[n], {n, 1, 15}] (* Jean-François Alcover, Feb 17 2014, after Alois P. Heinz *)

Formula

a(n) = A002884(n) / 2^(n-1).

Extensions

More terms from Eric M. Schmidt, May 14 2013

A105670 a(1)=1 then bracketing n by powers of 2 as f(t)=2^t for f(t) < n <= f(t+1), a(n) = f(t+1) - a(n-f(t)).

Original entry on oeis.org

1, 1, 3, 3, 7, 7, 5, 5, 15, 15, 13, 13, 9, 9, 11, 11, 31, 31, 29, 29, 25, 25, 27, 27, 17, 17, 19, 19, 23, 23, 21, 21, 63, 63, 61, 61, 57, 57, 59, 59, 49, 49, 51, 51, 55, 55, 53, 53, 33, 33, 35, 35, 39, 39, 37, 37, 47, 47, 45, 45, 41, 41, 43, 43, 127, 127, 125, 125, 121, 121, 123
Offset: 1

Views

Author

Benoit Cloitre, May 03 2005

Keywords

Crossrefs

Programs

  • Maple
    A062383 := proc(n)
            ceil(log(n)/log(2)) ;
            2^% ;
    end proc:
    A105670 := proc(n)
            option remember;
            if n = 1 then
                    1;
            else
                    fn1 := A062383(n) ;
                    fn := fn1/2 ;
                    fn1-procname(n-fn) ;
            end if;
    end proc:
    seq(A105670(n),n=1..80) ; # R. J. Mathar, Nov 06 2011
  • Mathematica
    t[0] = 0; t[1] = 1; t[n_?EvenQ] := t[n] = t[n/2]; t[n_?OddQ] := t[n] = 1 - t[(n-1)/2]; a[1] = 1; a[n_?EvenQ] := a[n] = a[n - 1]; a[n_] := a[n] = 2*a[Ceiling[n/2]] - 1 + 2*t[Ceiling[n/2] - 1]; Table[a[n], {n, 1, 71}] (* Jean-François Alcover, Aug 13 2013 *)
  • PARI
    b(n,m)=if(n<2,1,m*m^floor(log(n-1)/log(m))-b(n-m^floor(log(n-1)/log(m)),m))

Formula

a(2n-1) = a(2n).
a(n) = 2*a(ceiling(n/2)) -1 + 2*t(ceiling(n/2)-1) where t(n) = A010060(n) is the Thue-Morse sequence.
a(2n-1) = a(2n) = 2*A006068(n-1)+1. - Jeffrey Shallit, Mar 15 2025

Extensions

Typo in data corrected by Jean-François Alcover, Aug 13 2013

A295609 a(n) = least prime number p such that p AND n = n (where AND denotes the binary AND operator).

Original entry on oeis.org

2, 3, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13, 13, 31, 31, 17, 17, 19, 19, 23, 23, 23, 23, 29, 29, 31, 31, 29, 29, 31, 31, 37, 37, 43, 43, 37, 37, 47, 47, 41, 41, 43, 43, 47, 47, 47, 47, 53, 53, 59, 59, 53, 53, 127, 127, 59, 59, 59, 59, 61, 61, 127, 127, 67, 67
Offset: 0

Views

Author

Rémy Sigrist, Nov 24 2017

Keywords

Comments

For any n > 0: gcd(A109613(n), A062383(n)) = 1, hence, by Dirichlet's theorem on arithmetic progressions, we have a prime number, say p, of the form A109613(n) + k * A062383(n) with k > 0; this prime number satisfies p AND n = n; also a(0) = 2, hence the sequence is well defined for any n >= 0.
a(n) = n iff n is prime.
Each prime number appears 2*k times in this sequence for some k > 0.

Examples

			a(42) = 42 + A295335(42) = 42 + 1 = 43.
		

Crossrefs

Programs

  • Mathematica
    Table[Block[{p = 2}, While[BitAnd[p, n] != n, p = NextPrime@ p]; p], {n, 0, 65}] (* Michael De Vlieger, Nov 26 2017 *)
  • PARI
    avoid(n,i) = if (i, if (n%2, 2*avoid(n\2,i), 2*avoid(n\2,i\2)+(i%2)), 0) \\ (i+1)-th number k such that k AND n = 0
    a(n) = for (i=0, oo, my (k=avoid(n,i)); if (isprime(n+k), return (n+k)))

Formula

a(n) = n + A295335(n).
For any k > 1, a(2*k) = a(2*k+1).

A065159 Binary string self-substitutions: a(n) is obtained by substituting the binary expansion of n for each 1-bit in the binary expansion of n.

Original entry on oeis.org

0, 1, 4, 15, 16, 85, 108, 511, 64, 585, 660, 5819, 816, 7085, 7644, 65535, 256, 4369, 4644, 78451, 5200, 87381, 91564, 1531639, 6336, 105625, 109876, 1825659, 118384, 1961821, 2029500, 33554431, 1024, 33825, 34884, 1149155, 37008, 1217189, 1250124, 41056743
Offset: 0

Views

Author

Marc LeBrun, Oct 18 2001

Keywords

Examples

			a(5): 5 = 101 -> (101)0(101) = 1010101 = 85.
		

Crossrefs

Programs

  • Mathematica
    bss[n_]:=Module[{idn2=IntegerDigits[n,2]},FromDigits[Flatten[idn2/.{1-> idn2}],2]]; Array[bss,40,0] (* Harvey P. Dale, Aug 15 2017 *)
  • Python
    def a(n): b = bin(n)[2:]; return int(b.replace("1", b), 2)
    print([a(n) for n in range(40)]) # Michael S. Branicky, Aug 05 2022

Formula

a(0) = 0. a(2^n) = 4^n. a(4n+2) = (4n+2)*(1+a(4n+1)/(4n+1)).
a(n) = A065157(n,n) = A065158(n,n)*n = A065160(n)*n.
a(n) =z(n, n) with z(u, v) = if u=0 then 0 else if u mod 2 = 0 then z(u/2, v)*2 else z([u/2], v)*A062383(v)+v. - Reinhard Zumkeller, Feb 15 2004

Extensions

Name clarified by Michael S. Branicky, Aug 05 2022

A179857 Smallest number greater than n having in binary representation exactly twice the number of ones as n has in binary representation.

Original entry on oeis.org

3, 3, 15, 5, 15, 15, 63, 9, 15, 15, 63, 15, 63, 63, 255, 17, 23, 23, 63, 23, 63, 63, 255, 27, 63, 63, 255, 63, 255, 255, 1023, 33, 39, 39, 63, 39, 63, 63, 255, 43, 63, 63, 255, 63, 255, 255, 1023, 51, 63, 63, 255, 63, 255, 255, 1023, 63, 255, 255, 1023, 255, 1023, 1023
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 31 2010

Keywords

Comments

a(n) = Min{m: m > n and A000120(m) = 2*A000120(n)};
a(n) is odd;
n < a(n) < A000290(A062383(n));
a(A000079(n)) = A000051(n);
A024036 and A000225 give record values and where they occur.

Crossrefs

Programs

  • Mathematica
    br2[n_]:=Module[{k=If[EvenQ[n],n+1,n+2],t=2*DigitCount[n,2,1]},While[ DigitCount[ k,2,1]!=t,k=k+2];k]; Array[br2,70] (* Harvey P. Dale, Sep 20 2016 *)
  • PARI
    a(n) = my(k=n+1, h=hammingweight(n)); while (hammingweight(k) != 2*h, k++); k; \\ Michel Marcus, Nov 13 2023

Extensions

Definition clarified by Harvey P. Dale, Sep 20 2016
Previous Showing 31-40 of 66 results. Next