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.

A036044 BCR(n): write in binary, complement, reverse.

Original entry on oeis.org

1, 0, 2, 0, 6, 2, 4, 0, 14, 6, 10, 2, 12, 4, 8, 0, 30, 14, 22, 6, 26, 10, 18, 2, 28, 12, 20, 4, 24, 8, 16, 0, 62, 30, 46, 14, 54, 22, 38, 6, 58, 26, 42, 10, 50, 18, 34, 2, 60, 28, 44, 12, 52, 20, 36, 4, 56, 24, 40, 8, 48, 16, 32, 0, 126, 62, 94, 30, 110, 46, 78, 14, 118, 54, 86
Offset: 0

Views

Author

Keywords

Comments

a(0) could be considered to be 0 if the binary representation of zero were chosen to be the empty string. - Jason Kimberley, Sep 19 2011
From Bernard Schott, Jun 15 2021: (Start)
Except for a(0) = 1, every term is even.
For each q >= 0, there is one and only one odd number h such that a(n) = 2*q iff n = h*2^m-1 for m >= 1 when q = 0, and for m >= 0 when q >= 1 (see A345401 and some examples below).
a(n) = 0 iff n = 2^m-1 for m >= 1 (Mersenne numbers) (A000225).
a(n) = 2 iff n = 3*2^m-1 for m >= 0 (A153893).
a(n) = 4 iff n = 7*2^m-1 for m >= 0 (A086224).
a(n) = 6 iff n = 5*2^m-1 for m >= 0 (A153894).
a(n) = 8 iff n = 15*2^m-1 for m >= 0 (A196305).
a(n) = 10 iff n = 11*2^m-1 for m >= 0 (A086225).
a(n) = 12 iff n = 13*2^m-1 for m >= 0 (A198274).
For k >= 1, a(n) = 2^k iff n = (2^(k+1)-1)*2^m - 1 for m >= 0.
Explanation for a(n) = 2:
For m >= 0, A153893(m) = 3*2^m-1 -> 1011...11 -> 0100...00 -> 10 -> 2 where 1011...11_2 is 10 followed by m 1's. (End)

Examples

			4 -> 100 -> 011 -> 110 -> 6.
		

Crossrefs

Cf. A035928 (fixed points), A195063, A195064, A195065, A195066.
Indices of terms 0, 2, 4, 6, 8, 10, 12, 14, 18, 22, 26, 30: A000225 \ {0}, A153893, A086224, A153894, A196305, A086225, A198274, A052996\{1,3}, A291557, A198276, A171389, A198275.

Programs

  • Haskell
    import Data.List (unfoldr)
    a036044 0 = 1
    a036044 n = foldl (\v d -> 2 * v + d) 0 (unfoldr bc n) where
       bc 0 = Nothing
       bc x = Just (1 - m, x') where (x',m) = divMod x 2
    -- Reinhard Zumkeller, Sep 16 2011
    
  • Magma
    A036044:=func; // Jason Kimberley, Sep 19 2011
    
  • Maple
    A036044 := proc(n)
        local bcr ;
        if n = 0 then
            return 1;
        end if;
        convert(n,base,2) ;
        bcr := [seq(1-i,i=%)] ;
        add(op(-k,bcr)*2^(k-1),k=1..nops(bcr)) ;
    end proc:
    seq(A036044(n),n=0..200) ; # R. J. Mathar, Nov 06 2017
  • Mathematica
    dtn[ L_ ] := Fold[ 2#1+#2&, 0, L ]; f[ n_ ] := dtn[ Reverse[ 1-IntegerDigits[ n, 2 ] ] ]; Table[ f[ n ], {n, 0, 100} ]
    Table[FromDigits[Reverse[IntegerDigits[n,2]/.{1->0,0->1}],2],{n,0,80}] (* Harvey P. Dale, Mar 08 2015 *)
  • PARI
    a(n)=fromdigits(Vecrev(apply(n->1-n,binary(n))),2) \\ Charles R Greathouse IV, Apr 22 2015
    
  • Python
    def comp(s): z, o = ord('0'), ord('1'); return s.translate({z:o, o:z})
    def BCR(n): return int(comp(bin(n)[2:])[::-1], 2)
    print([BCR(n) for n in range(75)]) # Michael S. Branicky, Jun 14 2021
    
  • Python
    def A036044(n): return -int((s:=bin(n)[-1:1:-1]),2)-1+2**len(s) # Chai Wah Wu, Feb 04 2022

Formula

a(2n) = 2*A059894(n), a(2n+1) = a(2n) - 2^floor(log_2(n)+1). - Ralf Stephan, Aug 21 2003
Conjecture: a(n) = (-1)^A023416(n)*b(n) for n > 0 with a(0) = 1 where b(2^m) = (-1)^m*(2^(m+1) - 2) for m >= 0, b(2n+1) = b(n) for n > 0, b(2n) = b(n) + b(n - 2^f(n)) + b(2n - 2^f(n)) for n > 0 and where f(n) = A007814(n) (see A329369). - Mikhail Kurkov, Dec 13 2024

A086224 a(n) = 7*2^n - 1.

Original entry on oeis.org

6, 13, 27, 55, 111, 223, 447, 895, 1791, 3583, 7167, 14335, 28671, 57343, 114687, 229375, 458751, 917503, 1835007, 3670015, 7340031, 14680063, 29360127, 58720255, 117440511, 234881023, 469762047, 939524095, 1879048191, 3758096383, 7516192767, 15032385535, 30064771071
Offset: 0

Views

Author

Marco Matosic, Jul 27 2003

Keywords

Comments

a(n) = A164874(n+2,2); subsequence of A030130. - Reinhard Zumkeller, Aug 29 2009
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-3, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n-1)=(-1)^n*charpoly(A,-5). - Milan Janjic, Jan 27 2010

Crossrefs

Other sequences with recurrence a(n+1) = 2*a(n) + 1 are:
a(0) = 2 gives A153893, a(0)=3 essentially A126646.
a(0) = 4 gives A153894, a(0)=5 essentially A153893.
a(0) = 7 gives essentially A000225.
a(0) = 8 gives A052996 except for some initial terms,
a(0) = 9 is essentially A153894.
a(0) = 10 gives A086225,
a(0) = 11 is essentially A153893.
a(0) = 13 is essentially A086224.

Programs

  • Mathematica
    7*2^Range[0,30]-1 (* Harvey P. Dale, May 09 2018 *)
  • PARI
    a(n)=7<Charles R Greathouse IV, Sep 24 2015

Formula

a(n+1) = 2*a(n) + 1.
G.f.: (6-5*x)/((1-x)*(1-2*x)). - Jaume Oliver Lafont, Sep 14 2009
a(n-1)^2 + a(n) = (7*2^(n-1))^2. - Vincenzo Librandi, Aug 08 2010
a(n) = (A052940(n+1) + A000225(n+3))/2. - Gennady Eremin, Aug 31 2023
From Elmo R. Oliveira, Apr 22 2025: (Start)
E.g.f.: exp(x)*(7*exp(x) - 1).
a(n) = 3*a(n-1) - 2*a(n-2). (End)

Extensions

More terms from David Wasserman, Feb 22 2005

A075300 Array A read by antidiagonals upwards: A(n, k) = array A054582(n,k) - 1 = 2^n*(2*k+1) - 1 with n,k >= 0.

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 7, 11, 9, 6, 15, 23, 19, 13, 8, 31, 47, 39, 27, 17, 10, 63, 95, 79, 55, 35, 21, 12, 127, 191, 159, 111, 71, 43, 25, 14, 255, 383, 319, 223, 143, 87, 51, 29, 16, 511, 767, 639, 447, 287, 175, 103, 59, 33, 18, 1023, 1535, 1279, 895, 575, 351, 207, 119
Offset: 0

Views

Author

Antti Karttunen, Sep 12 2002

Keywords

Comments

From Philippe Deléham, Feb 19 2014: (Start)
A(0,k) = 2*k = A005843(k),
A(1,k) = 4*k + 1 = A016813(k),
A(2,k) = 8*k + 3 = A017101(k),
A(n,0) = A000225(n),
A(n,1) = A153893(n),
A(n,2) = A153894(n),
A(n,3) = A086224(n),
A(n,4) = A052996(n+2),
A(n,5) = A086225(n),
A(n,6) = A198274(n),
A(n,7) = A238087(n),
A(n,8) = A198275(n),
A(n,9) = A198276(n),
A(n,10) = A171389(n). (End)
A permutation of the nonnegative integers. - Alzhekeyev Ascar M, Jun 05 2016
The values in array row n, when expressed in binary, have n trailing 1-bits. - Ruud H.G. van Tol, Mar 18 2025

Examples

			The array A begins:
   0    2    4    6    8   10   12   14   16   18 ...
   1    5    9   13   17   21   25   29   33   37 ...
   3   11   19   27   35   43   51   59   67   75 ...
   7   23   39   55   71   87  103  119  135  151 ...
  15   47   79  111  143  175  207  239  271  303 ...
  31   95  159  223  287  351  415  479  543  607 ...
  ... - _Philippe Deléham_, Feb 19 2014
From _Wolfdieter Lang_, Jan 31 2019: (Start)
The triangle T begins:
   n\k   0    1    2   3   4   5   6   7  8  9 10 ...
   0:    0
   1:    1    2
   2:    3    5    4
   3:    7   11    9   6
   4:   15   23   19  13   8
   5    31   47   39  27  17  10
   6:   63   95   79  55  35  21  12
   7:  127  191  159 111  71  43  25  14
   8:  255  383  319 223 143  87  51  29 16
   9:  511  767  639 447 287 175 103  59 33 18
  10: 1023 1535 1279 895 575 351 207 119 67 37 20
  ...
T(3, 1) = 2^2*(2*1+1) - 1 = 12 - 1 = 11.  (End)
		

Crossrefs

Inverse permutation: A075301. Transpose: A075302. The X-projection is given by A007814(n+1) and the Y-projection A025480.

Programs

  • Maple
    A075300bi := (x,y) -> (2^x * (2*y + 1))-1;
    A075300 := n -> A075300bi(A025581(n), A002262(n));
    A002262 := n -> n - binomial(floor((1/2)+sqrt(2*(1+n))),2);
    A025581 := n -> binomial(1+floor((1/2)+sqrt(2*(1+n))),2) - (n+1);
  • Mathematica
    Table[(2^# (2 k + 1)) - 1 &[m - k], {m, 0, 10}, {k, 0, m}] (* Michael De Vlieger, Jun 05 2016 *)

Formula

From Wolfdieter Lang, Jan 31 2019: (Start)
Array A(n, k) = 2^n*(2*k+1) - 1, for n >= 0 and m >= 0.
The triangle is T(n, k) = A(n-k, k) = 2^(n-k)*(2*k+1) - 1, n >= 0, k=0..n.
See also A054582 after subtracting 1. (End)
From Ruud H.G. van Tol, Mar 17 2025: (Start)
A(0, k) is even. For n > 0, A(n, k) is odd and (3 * A(n, k) + 1) / 2 = A(n-1, 3*k+1).
A(n, k) = 2^n - 1 (mod 2^(n+1)) (equivalent to the comment about trailing 1-bits). (End)

A277215 a(n) is the smallest even number not congruent to 1 modulo 3 that starts a (2n+1)-element alternating sequence of x/2 and (3x+1) iterations ending in the maximum of its Collatz trajectory.

Original entry on oeis.org

0, 26, 6, 14, 30, 1214, 1662, 254, 510, 1022, 2046, 28670, 40958, 180222, 32766, 65534, 131070, 1835006, 5767166, 1048574, 2097150, 4194302, 8388606, 16777214, 33554430, 469762046, 671088638, 268435454, 536870910, 7516192766, 2147483646, 4294967294, 8589934590, 17179869182, 34359738366, 755914244094
Offset: 0

Views

Author

Hartmut F. W. Hoft, Nov 03 2016

Keywords

Comments

a(n) starts a maximal alternating Collatz sequence v_0, ..., v_2n of 2n+1 elements and must have the form v_0 = 2*(q*2^n - 1) where q is the smallest odd number not a multiple of 3 such that v_(2n) = 2*(q*3^n - 1) is the maximum of its Collatz trajectory.
The intermediate elements of the sequence for 1 <= j <= n are v_(2j-1) = q * 2^(n-j+1) * 3^(j-1) - 1, which is odd, and v_(2j) = 2 * (q * 2^(n-j) * 3^j - 1), which is congruent to 2 modulo 4 except for j=n.
A277875(n) is the odd multiplier q in the expression for a(n).
Subsequences of a(n) are related to subsequences of the following sequences depending on the value of q:
a(n) = 2*A000225(n) = A000918(n+1) when A277875(n) = 1;
a(n) = 2*A153894(n) = A131051(n+3) when A277875(n) = 5;
a(n) = 2*A086224(n) = A086224(n+1)-1 = A176448(n+1) when A277875(n) = 7;
a(n) = A086225(n+1)-1 when A277875(n) = 11;
a(n) = A198274(n+1)-1 when A277875(n) = 13;
a(n) = A198276(n+1)-1 when A277875(n) = 19;
For small q > 1, the positions of 2*(q*2^n - 1) among the first 200 numbers in the sequence are:
q = 5: 12, 26, 36, 46, 58, 62, 174;
q = 7: 1, 11, 17, 25, 29, 45, 49, 53, 57, 61, 65, 77, 93, 103, 109, 113, 117, 125, 139, 141, 145, 157, 165, 173, 187, 189, 193;
q = 11: 13, 18, 35, 59, 69, 75, 83, 114, 133, 179;
q = 13: 6, 118;
q = 19: 5;
and among the first 400 numbers are:
q = 17: 222, 229, 230, 268;
(see A277875).
Conjecture: For every n there is an odd number q such that the alternating sequence ends in v_(2n), the maximum of the Collatz trajectory of a(n)=v_0.

Examples

			a(0) = 0 = 2*(1*2^0 - 1) since it is the start and end of the first alternating sequence of 1 element and the maximum of its trajectory.
a(1) = 26 = 2*(7*2^1 - 1) since sequence 26, 13, 40 has 3 elements and ends in the maximum of its trajectory and since 2, 10 and 18 do not satisfy the conditions for a(1).
a(5) = 1214 = 2*(19*2^5 - 1) starts the alternating sequence of 11 elements - 1214, 607, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232 - that ends in the trajectory maximum 9232 while the 11-element alternating sequences starting at 2*(q*2^5 - 1) with odd q<19 either do not end at the trajectory maximum or are congruent to 1 modulo 3 and therefore do not have maximal length.
		

Crossrefs

Programs

  • Mathematica
    collatz[n_] := If[OddQ[n], 3n+1, n/2]
    altdata[low_, high_] := Module[{n, q, notDone, v, a, m, list={}}, For[n=low, n<=high, n++, q=-1; notDone=True; While[notDone, q+=2; v=2*(q*2^n-1); If[Mod[v, 3]!=1, a=NestWhile[collatz, v, Mod[#,4]!=0&]; m=Max[NestWhileList[collatz, a, #!=1&]]; notDone=(a!=m)]]; AppendTo[list, {n, q, v, a}]]; list]/;(low>1)
    a277215[n_]:=Map[#[[3]]&, altdata[2,n]]
    Join[{0,26}, a277215[35]] (* sequence data *)

A050525 Primes of the form 11*2^k - 1.

Original entry on oeis.org

43, 738197503, 12384898975268863, 198158383604301823, 935776509032580774524280170437362581503, 239558786312340678278215723631964820865023, 1243860333603982568026641440523014635142548663400435746517610765710004322303
Offset: 1

Views

Author

N. J. A. Sloane, Dec 29 1999

Keywords

Crossrefs

See A001772 for more terms.
Cf. A086225.

Programs

  • Mathematica
    Select[11 2^Range[0,250]-1,PrimeQ]  (* Harvey P. Dale, Mar 30 2011 *)

Formula

a(n) = A086225(A001772(n)). - Elmo R. Oliveira, May 04 2025

A345401 a(n) is the unique odd number h such that BCR(h*2^m-1) = 2n (except for BCR(0) = 1) where BCR is bit complement and reverse per A036044.

Original entry on oeis.org

1, 3, 7, 5, 15, 11, 13, 9, 31, 23, 27, 19, 29, 21, 25, 17, 63, 47, 55, 39, 59, 43, 51, 35, 61, 45, 53, 37, 57, 41, 49, 33, 127, 95, 111, 79, 119, 87, 103, 71, 123, 91, 107, 75, 115, 83, 99, 67, 125, 93, 109, 77, 117, 85, 101, 69, 121, 89, 105, 73, 113, 81, 97, 65, 255, 191
Offset: 0

Views

Author

Bernard Schott, Jun 18 2021

Keywords

Comments

This sequence is a permutation of the odd numbers.
We have BCR(a(n)*2^m-1) = 2n when n = 0 for m >= 1, and BCR(a(n)*2^m-1) = 2n when n >= 1 for m >= 0.
Why this exception when n = 0? As a(0) = 1, we have BCR(1*2^m-1) = 2*0 = 0 only for m >= 1, because, for m = 0, we have BCR(1*2^0-1) = BCR(0) = 1 <> 2*0 = 0.

Examples

			a(0) = 1 because BCR(1*2^m-1) = 2*0 = 0 for m >= 1 (A000225).
a(1) = 3 because BCR(3*2^m-1) = 2*1 = 2 for m >= 0 (A153893).
a(2) = 7 because BCR(7*2^m-1) = 2*2 = 4 for m >= 0 (A086224).
Indeed, a(1) = 3 because 3*2^m-1 = 1011..11_2 (i.e., 10 followed by m 1's), whose bit complement is 0100..00, which reverses to 10_2 = 2 = 2*1.
Also, a(43) = 75 because 75*2^m-1 = 100101011..11_2 (i.e., 1001010 followed by m 1's), whose bit complement is 011010100..00, which reverses to 1010110_2 = 86 = 2*43.
		

Crossrefs

Cf. A036044 (BCR), A059894.
When BCR(n) = 0, 2, 4, 6, 8, 10, 12, then corresponding a(n) = h = 1, 3, 7, 5, 15, 11, 13 and numbers h*2^m-1 are respectively in A000225, A153893, A086224, A153894, A196305, A086225, A198274.

Formula

a(n) = BCR(2*n) + 1 for n >= 1.
a(n) = 2*A059894(n) + 1 for n >= 1. - Hugo Pfoertner, Jun 18 2021
Showing 1-6 of 6 results.