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

A266150 Take the binary representation of n, increase each run of 0's by one 0 if the length of run is odd, otherwise, if length of run is even, remove one 0. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

0, 1, 4, 3, 2, 9, 12, 7, 16, 5, 36, 19, 6, 25, 28, 15, 8, 33, 20, 11, 18, 73, 76, 39, 48, 13, 100, 51, 14, 57, 60, 31, 64, 17, 132, 67, 10, 41, 44, 23, 144, 37, 292, 147, 38, 153, 156, 79, 24, 97, 52, 27, 50, 201, 204, 103, 112, 29, 228, 115, 30, 121, 124, 63, 32
Offset: 0

Views

Author

Alex Ratushnyak, Dec 21 2015

Keywords

Comments

This is a self-inverse permutation of the positive integers.

Examples

			a(4) = 2 since 4 = 100 binary -> 10 = 2 decimal.
a(5) = 9 since 5 = 101 binary -> 1001 = 9 decimal.
a(6) = 12 since 6 = 110 binary -> 1100 = 12 decimal.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[#, 2] &@ Flatten[If[First@ # == 0, If[OddQ@ Length@ #, Append[IntegerDigits@ #, 0], Most@ IntegerDigits@ #], #] & /@ Split@ IntegerDigits[n, 2]], {n, 64}] (* Michael De Vlieger, Dec 22 2015 *)
  • PARI
    a(n) = if (n==0, 0, my (b=n%2, r=valuation(n+b, 2), rr=if (b, r, r%2, r+1, r-1)); (a(n\2^r)+b)*2^rr-b) \\ Rémy Sigrist, Jan 20 2019

Extensions

a(0) = 0 prepended by Rémy Sigrist, Jan 20 2019

A266151 Take the binary representation of n, increase each run of 1's by one 1 if the length of run is odd, otherwise, if length of run is even, remove one 1. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

0, 3, 6, 1, 12, 27, 2, 15, 24, 51, 54, 13, 4, 11, 30, 7, 48, 99, 102, 25, 108, 219, 26, 111, 8, 19, 22, 5, 60, 123, 14, 63, 96, 195, 198, 49, 204, 411, 50, 207, 216, 435, 438, 109, 52, 107, 222, 55, 16, 35, 38, 9, 44, 91, 10, 47, 120, 243, 246, 61, 28, 59, 126, 31
Offset: 0

Views

Author

Alex Ratushnyak, Dec 21 2015

Keywords

Comments

This is a self-inverse permutation of the positive integers.

Examples

			a(4) = 12 since 4 = 100 binary -> 1100 = 12 decimal,
a(5) = 27 since 5 = 101 binary -> 110011 = 27 decimal,
a(6) = 2 since 6 = 110 binary -> 10 = 2 decimal.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[#, 2] &@ Flatten[If[First@ # == 1, If[OddQ@ Length@ #, Append[IntegerDigits@ #, 1], Most@ IntegerDigits@ #], #] & /@ Split@ IntegerDigits[n, 2]], {n, 63}] (* Michael De Vlieger, Dec 22 2015 *)
  • PARI
    a(n) = if (n==0, 0, my (b=n%2, r=valuation(n+b, 2), rr=if (b==0, r, r%2, r+1, r-1)); (a(n\2^r)+b)*2^rr-b) \\ Rémy Sigrist, Jan 20 2019

Extensions

a(0) = 0 prepended by Rémy Sigrist, Jan 20 2019

A323626 For any nonnegative real number x, let f(x) be the real number obtained by replacing in the binary expansions of the integer and fractional parts of x each finite run of k consecutive equal bits b with a run of k-(-1)^k consecutive bits b; a(n) is the numerator of f(1/n).

Original entry on oeis.org

3, 3, 1, 3, 1, 2, 3, 3, 1, 1, 13, 1, 7, 3, 1, 3, 1, 2, 77, 1, 1, 26, 203, 1, 817, 14, 109, 3, 1037, 2, 3, 3, 1, 1, 1297, 1, 20275, 77, 155, 1, 17, 1, 13, 13, 67, 203, 6716227, 1, 421735, 817, 17, 7, 2306997, 109, 55739, 3, 49, 1037, 818712813, 1, 138203853, 3
Offset: 1

Views

Author

Rémy Sigrist, Jan 20 2019

Keywords

Comments

When computing f(x), we consider the unique binary representation of x where the fractional part of x does not eventually end with repeating ones.
The function f establishes a self-inverse bijection:
- over the nonnegative real numbers,
- over the nonnegative real numbers in the half-open interval [0,1),
- over the nonnegative rational numbers,
- over the nonnegative rational numbers in the half-open interval [0,1),
- over the nonnegative integers (for any n >= 0, f(n) = A162853(n)).
The function f has only one fixed point: f(0) = 0.

Examples

			The first terms of the sequence, alongside f(1/n) and the binary representations of 1/n and of f(1/n) with periodic part in parentheses, are:
  n   a(n)  f(1/n)   bin(1/n)                bin(f(1/n))
  --  ----  -------  ----------------------  ------------------------
   1     3        3  1.(0)                   11.(0)
   2     3      3/4  0.1(0)                   0.11(0)
   3     1      1/5  0.(01)                   0.(0011)
   4     3     3/16  0.01(0)                  0.0011(0)
   5     1      1/3  0.(0011)                 0.(01)
   6     2      2/5  0.0(01)                  0.(0110)
   7     3      3/7  0.(001)                  0.(011)
   8     3      3/8  0.001(0)                 0.011(0)
   9     1     1/17  0.(000111)               0.(00001111)
  10     1     1/24  0.0(0011)                0.000(01)
  11    13   13/257  0.(0001011101)           0.(0000110011110011)
  12     1     1/20  0.00(01)                 0.00(0011)
  13     7    7/129  0.(000100111011)         0.(00001101111001)
  14     3     3/56  0.0(001)                 0.000(011)
  15     1     1/21  0.(0001)                 0.(000011)
  16     3     3/64  0.0001(0)                0.000011(0)
  17     1      1/9  0.(00001111)             0.(000111)
  18     2     2/17  0.0(000111)              0.(00011110)
  19    77  77/1025  0.(000011010111100101)   0.(00010011001110110011)
  20     1     1/12  0.00(0011)               0.00(01)
		

Crossrefs

See A323627 for the corresponding denominators.
Cf. A162853.

Programs

  • PARI
    See Links section.

Formula

a(2^k) = 3 for any k >= 0.
a(2^k-1) = 2-(-1)^k for any k > 0.
Showing 1-3 of 3 results.