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

A227987 If the run lengths of the binary representation of n are [1+r_1, 1+r_2, 1+r_3, ..., 1+r_k], then those of a(n) are [1+(r_1), 1+(r_1 XOR r_2), 1+(r_1 XOR r_2 XOR r_3), ..., 1+(r_1 XOR ... XOR r_k)], where XOR denotes the XOR binary operator.

Original entry on oeis.org

1, 2, 3, 4, 5, 12, 7, 8, 19, 10, 11, 6, 51, 56, 15, 16, 71, 76, 9, 20, 21, 44, 23, 48, 13, 204, 25, 112, 455, 240, 31, 32, 271, 568, 143, 38, 307, 18, 79, 40, 83, 42, 43, 22, 179, 184, 47, 24, 783, 26, 27, 102, 819, 50, 207, 14, 1807, 3640, 911, 120, 3855
Offset: 1

Views

Author

Paul Tek, Aug 02 2013

Keywords

Comments

This is a permutation of the natural numbers with inverse permutation A225607.
The sequence (n, a(n), a(a(n)), a(a(a(n))),...) is periodic for any n.
The run lengths of the binary representation of a fixed point are of the form [1, 1,...,1, K] (any number of ones followed by any number).

Examples

			For n=927:
(1) binary representation of n = "1110011111",
(2) run lengths of n = [1+2,1+1,1+4],
(3) run lengths of a(n) = [1+(2),1+(2 XOR 1),1+(2 XOR 1 XOR 4)]=[3,4,8],
(4) binary representation of a(n) = "111000011111111",
(5) a(n) = 28927.
		

Crossrefs

Cf. A056539, A226532, A225607 (inverse).

Programs

  • Perl
    # See Tek link.

A322463 Reverse runs of zeros in binary expansion of n and convert back to decimal.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 19, 18, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 40, 35, 36, 41, 44, 39, 34, 37, 42, 43, 38, 45, 46, 47, 48, 49, 52, 51, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 80, 67
Offset: 0

Views

Author

Rémy Sigrist, Dec 09 2018

Keywords

Comments

This sequence is a self-inverse permutation of nonnegative integers.

Examples

			For n = 150:
- the binary representation of 150 is "10010110",
- we have three runs of zeros: "00", "0" and "0",
- we exchange the first and the third run, and the second remains in place,
- we obtain: "10101100",
- hence a(150) = 172.
		

Crossrefs

See A322464 for the variant where we reverse the runs of ones.
See A056539 for a similar sequence.

Programs

  • Mathematica
    a[n_] := Module[{s=Split[IntegerDigits[n,2]]}, m=Length[s]; m2=m-Mod[m,2]; If[m2>0, ind=Riffle[Range[1,m,2],Range[m2,1,-2]]; FromDigits[Flatten[s[[ind]]],2],n]]; Array[a, 100, 0] (* Amiram Eldar, Dec 12 2018 *)
  • PARI
    a(n) = {
        my (r=n, z=[], v=0, p=1, i=0);
        while (r, my (l=valuation(r+(r%2),2)); if (r%2==0, z=concat(l,z)); r\=2^l);
        while (n, my (l=valuation(n+(n%2),2)); if (n%2, v+=(2^l-1)*p; p*=2^l, p*=2^z[i++]); n\=2^l);
        return (v);
    }

Formula

A000120(a(n)) = A000120(n).
A005811(a(n)) = A005811(n).
a(A164710(n)) = A164710(n).
a(A322464(n)) = A322464(a(n)).
a(2^n) = 2^n.
a(2^n-1) = 2^n-1.

A285916 Self-inverse permutation: in base 3, reverse the lengths of runs of consecutive equal digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 10, 11, 9, 13, 17, 15, 16, 14, 24, 19, 20, 21, 25, 23, 18, 22, 26, 39, 28, 29, 30, 37, 32, 33, 34, 38, 36, 31, 35, 27, 40, 53, 45, 49, 44, 42, 46, 47, 48, 43, 50, 51, 52, 41, 78, 55, 56, 57, 73, 59, 60, 61, 74, 75, 64, 65, 66, 79
Offset: 0

Views

Author

Rémy Sigrist, Apr 28 2017

Keywords

Comments

This sequence can be seen as an analog of A056539 for the base 3.
For any n>=0, n and a(n) have the same number of digits in base 3.

Examples

			The first terms for which n<>a(n) are:
Decimal:    Base 3:
n   a(n)    n       a(n)
-   ----    ---     ----
9   12      100     110
12  9       110     100
14  17      112     122
17  14      122     112
18  24      200     220
22  25      211     221
24  18      220     200
25  22      221     211
27  39      1000    1110
31  37      1011    1101
35  38      1022    1102
37  31      1101    1011
38  35      1102    1022
39  27      1110    1000
41  53      1112    1222
42  45      1120    1200
		

Crossrefs

Cf. A056539.

A290078 Where the ratio A235027(n)/n obtains record values.

Original entry on oeis.org

1, 11, 19, 67, 71, 263, 271, 781, 1273, 1349, 2981, 4757, 5041, 18157, 18673, 19241, 55451, 71273, 73441, 95779, 211651, 337747, 357911, 1289147, 1325783, 1366111, 3937021, 5060383, 5214311, 6800309, 15027221, 19314983, 19902511, 23980037, 25411681
Offset: 1

Views

Author

Antti Karttunen, Aug 07 2017

Keywords

Comments

Because A056539(n)/n < 2 for all n, and already for the tenth term of this sequence 1349 we have A235027(1349)/1349 = 2.094... it follows that the only primes present are terms a(2) .. a(7): 11, 19, 67, 71, 263, 271. Conjecture: every term after that is a product of some of those six primes. For example: 781 = 11*71, 1273 = 19*67, 1349 = 19*71, 2981 = 11*271, 4757 = 67*71, 5041 = 71*71.

Crossrefs

Cf. A235027.

Programs

  • PARI
    revbits(n) = fromdigits(Vecrev(binary(n)), 2);
    A235027(n) = {my(f = factor(n)); for (k=1, #f~, if (f[k, 1] != 2, f[k, 1] = revbits(f[k, 1]); ); ); factorback(f); } \\ This function from Michel Marcus, Aug 05 2017
    m=0; i=0; n=0; while(i<35, n++; if((A235027(n)/n) > m, m = A235027(n)/n; i++; print1(n,",")));

A335858 Nonnegative integers ordered by binary length and then lexicographically by run lengths (considering least significant runs first).

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 4, 7, 10, 13, 9, 14, 11, 12, 8, 15, 21, 26, 18, 29, 22, 25, 17, 30, 20, 27, 19, 28, 23, 24, 16, 31, 42, 53, 37, 58, 45, 50, 34, 61, 41, 54, 38, 57, 46, 49, 33, 62, 43, 52, 36, 59, 44, 51, 35, 60, 40, 55, 39, 56, 47, 48, 32, 63, 85, 106, 74
Offset: 0

Views

Author

Rémy Sigrist, Jun 27 2020

Keywords

Comments

The variant where we consider most significant runs first apparently corresponds to A180200.

Examples

			The first terms, alongside the corresponding binary representation and run lengths, are:
  n   a(n)  bin(a(n))  A227736(n, *)
  --  ----  ---------  -------------
   0     0          0  ()
   1     1          1  (1)
   2     2         10  (1, 1)
   3     3         11  (2)
   4     5        101  (1, 1, 1)
   5     6        110  (1, 2)
   6     4        100  (2, 1)
   7     7        111  (3)
   8    10       1010  (1, 1, 1, 1)
   9    13       1101  (1, 1, 2)
  10     9       1001  (1, 2, 1)
  11    14       1110  (1, 3)
  12    11       1011  (2, 1, 1)
  13    12       1100  (2, 2)
  14     8       1000  (3, 1)
  15    15       1111  (4)
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

Apparently a(n) = A056539(A180200(n)).

A337672 Numbers with binary expansion Sum_{k = 0..w} b_k * 2^k such that the polynomial Sum_{k = 0..w} (X+k)^2 * (-1)^b_k is constant.

Original entry on oeis.org

0, 9, 150, 153, 165, 195, 2268, 2282, 2289, 2364, 2394, 2406, 2409, 2454, 2457, 2469, 2499, 2618, 2646, 2649, 2661, 2702, 2709, 2723, 2829, 2835, 3126, 3129, 3150, 3157, 3171, 3213, 3219, 3339, 3591, 34680, 34740, 34764, 34770, 34785, 35576, 35700, 35756
Offset: 1

Views

Author

Rémy Sigrist, Sep 15 2020

Keywords

Comments

Leading 0's in binary expansions are ignored.
Positive terms are digitally balanced (A031443).
If m belongs to the sequence, then A056539(m) also belongs to the sequence.
If m and n belong to the sequence, then their binary concatenation also belongs to the sequence (assuming the concatenation with 0 is neutral).

Examples

			The first 16 integers, alongside their binary representations and associate polynomials, are:
  k   bin(k)  P(k)
  --  ------  --------------
   0       0               0
   1       1            -X^2
   2      10           2*X+1
   3      11    -2*X^2-2*X-1
   4     100       X^2+6*X+5
   5     101      -X^2-2*X-3
   6     110      -X^2+2*X+3
   7     111    -3*X^2-6*X-5
   8    1000   2*X^2+12*X+14
   9    1001              -4
  10    1010           4*X+6
  11    1011   -2*X^2-8*X-12
  12    1100          8*X+12
  13    1101    -2*X^2-4*X-6
  14    1110        -2*X^2+4
  15    1111  -4*X^2-12*X-14
We have constant polynomials for k = 0 and k = 9, so a(1) = 0 and a(2) = 9.
		

Crossrefs

Programs

  • PARI
    is(n) = { my (b=Vecrev(binary(n))); poldegree(p=sum(k=1, #b, ('X+k-1)^2 * (-1)^b[k]))<=0 }
Previous Showing 31-36 of 36 results.