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

A300958 Fixed points of A300956.

Original entry on oeis.org

0, 15, 21, 21141, 21156, 21162, 40095, 40110, 40116, 72171, 72186, 72192, 93312, 93327, 93333, 112266, 112281, 112287, 124659, 124674, 124680, 145800, 145815, 145821, 164754, 164769, 164775, 181521, 181536, 181542, 202662, 202677, 202683, 221616, 221631
Offset: 1

Views

Author

Rémy Sigrist, Mar 17 2018

Keywords

Comments

In ternary representation:
- each term has as many 1's as 2's and the set of positions of 1's is the image under A300956 of the set of positions of 2's and vice versa (where the position 0 corresponds to the unit ternary digit),
- the digit at position a(k) of a term is always zero for any k > 0; in particular, as a(1) = 0, all terms are divisible by 3.
To compute a(n):
- consider the sequence of integers k, say f, such that A300956(k) < k,
- the sequence f starts: 2, 9, 10, 11, 17, 18, 19, 20, 23, 24, 25, 26, 19683, ...
- let g(k, t) be defined for k > 0 and t = 0..2 as: g(k, 0) = 0, g(k, 1) = 3^f(k) + 2 * 3^A300956(f(k)), g(k, 2) = 2 * 3^f(k) + 3^A300956(f(k)),
- let Sum_{i = 0..m} t_i * 3^i be the ternary representation of n-1,
- then a(n) = Sum_{i = 0..m} g(i+1, t_i).

Crossrefs

Programs

  • PARI
    See Links section.

Formula

A062756(a(n)) = A081603(a(n)).

A300948 a(1) = 2, a(2) = 1, and for any n > 2 with binary expansion Sum_{i=0..k} b_i * 2^i, a(n) = Sum_{i=0..k} b_i * 2^(a(i+1)-1).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 16 2018

Keywords

Comments

More informally, in binary, the a(k)-th bit of a(n) is set iff the k-th bit of n is set (where the least significant bit has index 1).
For any k >= 0, the restriction of this sequence to the first A007013(k) terms is a self-inverse permutation preserving the Hamming weight; this property can be proven by induction.
This sequence is a self-inverse permutation of the natural numbers.
This sequence has infinitely many fixed points (A300950); for any k >= 0, at least one of 2^k or 2^k + a(2^k) is a fixed point.
See also A300955 and A300956 for sequences in the same vein.

Examples

			a(3) = a(2^1 + 2^0) = 2^(a(2)-1) + 2^(a(1)-1) = 2^0 + 2^1 = 3.
a(4) = a(2^2) = 2^(a(3)-1) = 2^2 = 4.
a(6) = a(2^2 + 2^1) = 2^(a(3)-1) + 2^(a(2)-1) = 2^2 + 2^0 = 5.
a(42) = a(2^5 + 2^3 + 2^1) = 2^(a(6)-1) + 2^(a(4)-1) + 2^(a(2)-1) = 2^4 + 2^3 + 2^0 = 25.
		

Crossrefs

Cf. A000120, A007013, A300950 (fixed points), A300955, A300956.

Programs

  • Mathematica
    a[1] = 2; a[2] = 1; a[n_] := a[n] = With[{b = IntegerDigits[n, 2] // Reverse}, Sum[If[b[[i]] == 1, 2^(a[i]-1), 0], {i, Length[b]}]]; Array[a, 100] (* Jean-François Alcover, Mar 17 2018 *)
  • PARI
    a(n) = if (n==1, 2, n==2, 1, my (b=Vecrev(binary(n))); sum(i=1, #b, if (b[i], 2^(a(i)-1), 0)))

Formula

A000120(a(n)) = A000120(n).
a(a(n)) = n.
Showing 1-2 of 2 results.