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.

A193231 Blue code for n: in binary coding of a polynomial over GF(2), substitute x+1 for x (see Comments for precise definition).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This is a self-inverse permutation of the nonnegative integers.
The function "substitute x+1 for x" on polynomials over GF(2) is completely multiplicative.
What is the density of fixed points in this sequence? Do we get a different answer if we look only at irreducible polynomials?
From Antti Karttunen, Dec 27 2013: (Start)
As what comes to the above question, the number of fixed points in range [2^(n-1),(2^n)-1] of the sequence is given by A131575(n). In range [0,0] there is one fixed point: 0, in range [1,1] there is also one: 1, in range [2,3] there are no fixed points, in range [4,7] there are two fixed points: 6 and 7, and so on. (Cf. also the C-code given in A118666.)
Similarly, the number of cycles in such ranges begins as 1, 1, 1, 3, 4, 10, 16, 36, 64, 136, ... which is A051437 shifted two steps right (prepended with 1's): Because the sequence is a self-inverse permutation, the number of its cycles in range [2^(n-1),(2^n)-1] is computed as: cycles(n) = (A011782(n)-number_of_fixedpoints(n))/2 + number_of_fixedpoints(n), which matches with the identity: A051437(n-2) = (A011782(n)-A131575(n))/2 + A131575(n), for n>=2.
In OEIS terms, the above comment about multiplicativeness can be rephrased as: a(A048720(x,y)) = A048720(a(x),a(y)) for all integers x, y >= 0. Here A048720(x,y) gives the product of carryless binary multiplication of x and y.
The permutation conjugates between Gray code and its inverse: A003188(n) = a(A006068(a(n))) and A006068(n) = a(A003188(a(n))) [cf. the identity 1.19-9d: gB = Bg^{-1} given on page 53 of fxtbook].
Because of the multiplicativity, the subset of irreducible (and respectively: composite) polynomials over GF(2) is closed under this permutation. Cf. the following mappings: a(A014580(n)) = A234750(n) and a(A091242(n)) = A234745(n).
(End)

Examples

			11, binary 1011, corresponds to polynomial x^3+x+1, substituting: (x+1)^3+(x+1)+1 = x^3+x^2+x+1 + x+1 + 1 = x^3+x^2+1, binary 1101 = decimal 13, so a(11) = 13.
From _Tilman Piesk_, Jun 26 2025: (Start)
The binary exponents of 11 are {0, 1, 3}, because 11 = 2^0 + 2^1 + 2^3.
a(11) = A001317(0) XOR A001317(1) XOR A001317(3) = 1 XOR 3 XOR 15 = 13. (End)
		

Crossrefs

Cf. A000069, A001969, A001317, A003987, A048720, A048724, A065621, A051437, A118666 (fixed points), A131575, A234022 (the number of 1-bits), A234023, A010060, A234745, A234750.
Similarly constructed permutation pairs: A003188/A006068, A135141/A227413, A232751/A232752, A233275/A233276, A233277/A233278, A233279/A233280.
Other permutations based on this (by conjugating, composing, etc): A234024, A234025/A234026, A234027, A234612, A234613, A234747, A234748, A244987, A245812, A245454.

Programs

  • Mathematica
    f[n_] := Which[0 <= # <= 1, #, EvenQ@ #, BitXor[2 #, #] &[f[#/2]], True, BitXor[#, 2 # + 1] &[f[(# - 1)/2]]] &@ Abs@ n; Table[f@ n, {n, 0, 66}] (* Michael De Vlieger, Feb 12 2016, after Robert G. Wilson v at A048724 and A065621 *)
  • PARI
    tox(n) = local(x=Mod(1,2)*X, xp=1, r); while(n>0,if(n%2,r+=xp);xp*=x;n\=2);r
    a(n)=subst(lift(subst(tox(n),X,X+1)),X,2)
    
  • PARI
    a(n)={local(x='x);subst(lift(Mod(1,2)*subst(Pol(binary(n),x),x,1+x)),x,2)};
    
  • Python
    def a065621(n): return n^(2*(n - (n&-n)))
    def a048724(n): return n^(2*n)
    l=[0, 1]
    for n in range(2, 101):
        if n%2==0: l.append(a048724(l[n//2]))
        else: l.append(a065621(1 + l[(n - 1)//2]))
    print(l) # Indranil Ghosh, Jun 04 2017
  • Scheme
    ;; with memoizing macro definec available in Antti Karttunen's IntSeq-library:
    (define (A193231 n) (let loop ((n n) (i 0) (s 0)) (cond ((zero? n) s) ((even? n) (loop (/ n 2) (+ 1 i) s)) (else (loop (/ (- n 1) 2) (+ 1 i) (A003987bi s (A001317 i))))))) ;; A003987bi implements binary XOR, A003987.
    ;; Antti Karttunen, Dec 27 2013
    
  • Scheme
    ;; With memoizing macro definec available in Antti Karttunen's IntSeq-library.
    ;; Alternative implementation, a recurrence based on entangling even & odd numbers with complementary pair A048724 and A065621:
    (definec (A193231 n) (cond ((< n 2) n) ((even? n) (A048724 (A193231 (/ n 2)))) (else (A065621 (+ (A193231 (/ (- n 1) 2)) 1)))))
    ;; Antti Karttunen, Dec 27 2013
    

Formula

From Antti Karttunen, Dec 27 2013: (Start)
a(0) = 0, and for any n = 2^a + 2^b + ... + 2^c, a(n) = A001317(a) XOR A001317(b) XOR ... XOR A001317(c), where XOR is bitwise XOR (A003987) and all the exponents a, b, ..., c are distinct, that is, they are the indices of 1-bits in the binary representation of n.
From above it follows, because all terms of A001317 are odd, that A000035(a(n)) = A010060(n) = A000035(a(2n)). Conversely, we also have A010060(a(n)) = A000035(n). Thus the permutation maps any even number to some evil number, A001969 (and vice versa), like it maps any odd number to some odious number, A000069 (and vice versa).
a(0)=0, a(1)=1, and for n>1, a(2n) = A048724(a(n)), a(2n+1) = A065621(1+a(n)). [A recurrence based on entangling even & odd numbers with the complementary pair A048724/A065621]
For all n, abs(a(2n)-a(2n+1)) = 1.
a(A000079(n)) = A001317(n).
(End)
It follows from the first paragraph above that a(A003987(n,k)) = A003987(a(n), a(k)), that is a(n XOR k) = a(n) XOR a(k). - Peter Munn, Nov 27 2019

A246163 Permutation of natural numbers: a(1) = 1, a(A014580(n)) = A065621(1+a(n)), a(A091242(n)) = A048724(a(n)), where A065621(n) and A048724(n) give the reversing binary representation of n and -n, respectively, and A014580 resp. A091242 are the binary coded irreducible resp. reducible polynomials over GF(2).

Original entry on oeis.org

1, 2, 7, 3, 6, 9, 8, 5, 10, 27, 4, 24, 11, 15, 30, 45, 12, 40, 26, 29, 17, 34, 119, 20, 25, 120, 46, 39, 51, 102, 14, 153, 60, 43, 136, 114, 31, 105, 85, 170, 44, 18, 427, 68, 125, 408, 13, 150, 33, 187, 255, 510, 116, 54, 41, 765, 204, 135, 28, 680, 16, 23, 442, 99, 461, 257, 35, 514, 156, 90, 123, 1799, 118, 340, 393, 36
Offset: 1

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where the two complementary pairs to be entangled with each other are A014580/A091242 (binary codes for irreducible and reducible polynomials over GF(2)) and A065621/A048724, the latter which themselves are permutations of A000069/A001969 (odious and evil numbers), which means that this permutation shares many properties with A246161.
Because 3 is the only evil number in A014580, it implies that, apart from a(3)=7, odious numbers occur in odious positions only (along with many evil numbers that also occur in odious positions).
Furthermore, all terms of A246158 reside in infinite cycles, and apart from 4 and 8, all of them reside in separate cycles. The infinite cycle containing 4 and 8 goes as: ..., 2091, 97, 47, 13, 11, 4, 3, 7, 8, 5, 6, 9, 10, 27, 46, 408, 2535, ... and it is only because a(3) = 7, that it can temporarily switch back from evil terms to odious terms, until right after a(8) = 5 it is finally doomed to the eternal evilness.
Please see also the comments at A246201 and A246161.

Crossrefs

Inverse: A246164.
Similar or related permutations: A246205, A193231, A246201, A234026, A245701, A234612, A246161, A246203.

Formula

a(1) = 1, and for n > 1, if n is in A014580, a(n) = A065621(1+a(A091226(n))), otherwise a(n) = A048724(a(A091245(n))).
As a composition of related permutations:
a(n) = A193231(A246201(n)).
a(n) = A234026(A245701(n)).
a(n) = A234612(A246161(n)).
a(n) = A193231(A246203(A193231(n))).
Other identities:
For all n > 1, A010060(a(n)) = A091225(n). [Maps binary representations of irreducible GF(2) polynomials (A014580) to odious numbers and the corresponding representations of reducible polynomials (A091242) to evil numbers, in some order].

A246164 Permutation of natural numbers: a(1) = 1, a(A065621(n)) = A014580(a(n-1)), a(A048724(n)) = A091242(a(n)), where A065621(n) and A048724(n) are the reversing binary representation of n and -n, respectively, and A014580 resp. A091242 are the binary coded irreducible resp. reducible polynomials over GF(2).

Original entry on oeis.org

1, 2, 4, 11, 8, 5, 3, 7, 6, 9, 13, 17, 47, 31, 14, 61, 21, 42, 185, 24, 87, 319, 62, 12, 25, 19, 10, 59, 20, 15, 37, 229, 49, 22, 67, 76, 415, 103, 28, 18, 55, 137, 34, 41, 16, 27, 97, 78, 425, 109, 29, 1627, 222, 54, 283, 433, 79, 373, 3053, 33, 131, 647, 108, 847, 133, 745, 6943, 44, 193, 1053, 160, 504, 4333, 587, 99
Offset: 1

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where the two complementary pairs to be entangled with each other are A065621/A048724 and A014580/A091242 (binary codes for irreducible and reducible polynomials over GF(2)).
The former are themselves permutations of A000069/A001969 (odious and evil numbers), which means that this permutation shares many properties with A246162.
For the comments about the cycle structure, please see A246163.

Crossrefs

Formula

a(1) = 1, and for n > 1, if A010060(n) = 1 [i.e. when n is an odious number], a(n) = A014580(a(A065620(n)-1)), otherwise a(n) = A091242(a(- (A065620(n)))). [A065620 Converts sum of powers of 2 in binary representation of n to an alternating sum].
As a composition of related permutations:
a(n) = A246202(A193231(n)).
a(n) = A245702(A234025(n)).
a(n) = A246162(A234612(n)).
a(n) = A193231(A246204(A193231(n))).
For all n > 1, A091225(a(n)) = A010060(n). [Maps odious numbers to binary representations of irreducible GF(2) polynomials (A014580) and evil numbers to the corresponding representations of reducible polynomials (A091242), in some order. A246162 has the same property].

A246161 Permutation of positive integers: a(1) = 1, a(A014580(n)) = A000069(1+a(n)), a(A091242(n)) = A001969(1+a(n)), where A000069 and A001969 are the odious and evil numbers, and A014580 resp. A091242 are the binary coded irreducible resp. reducible polynomials over GF(2).

Original entry on oeis.org

1, 2, 4, 3, 5, 9, 8, 6, 10, 18, 7, 17, 11, 12, 20, 36, 15, 34, 19, 23, 24, 40, 72, 30, 16, 68, 39, 46, 48, 80, 13, 144, 60, 33, 136, 78, 21, 92, 96, 160, 37, 27, 288, 120, 66, 272, 14, 156, 43, 184, 192, 320, 75, 54, 35, 576, 240, 132, 22, 544, 25, 29, 312, 86, 368, 384, 41
Offset: 1

Views

Author

Antti Karttunen, Aug 17 2014

Keywords

Comments

This is an instance of entanglement permutation, where the two complementary pairs to be entangled with each other are A014580/A091242 (binary codes for irreducible and reducible polynomials over GF(2)) and A000069/A001969 (odious and evil numbers).
Because 3 is the only evil number in A014580, it implies that, apart from a(3)=4, odious numbers occur in odious positions only (along with many evil numbers that also occur in odious positions).
Note that the two values n=21 and n=35 given in the Example section both encode polynomials reducible over GF(2) and have an odd number of 1-bits in their binary representation (that is, they are both terms of A246158). As this permutation maps all terms of A091242 to the terms of A001969, and apart from a single exception 3 (which here is in a closed cycle: a(3) = 4, a(4) = 3), no term of A001969 is a member of A014580, so they must be members of A091242, thus successive iterations a(21), a(a(21)), a(a(a(21))), etc. always yield some evil number (A001969), so the cycle can never come back to 21 as it is an odious number, so that cycle must be infinite.
On the other hand, when we iterate with the inverse of this permutation, A246162, starting from 21, we see that its successive pre-images 37, 41, 67, 203, 5079 [e.g., 21 = a(a(a(a(a(5079)))))] are all irreducible and thus also odious.
In each such infinite cycle, there can be at most one term which is both reducible (in A091242) and odious (in A000069), i.e. in A246158, thus 21 and 35 must reside in different infinite cycles.
The sequence of fixed points begin as: 1, 2, 5, 19, 54, 71, 73, 865.
Question: apart from them and transposition (3 4) are there any more instances of finite cycles?

Examples

			Consider n=21. In binary it is 10101, encoding for polynomial x^4 + x^2 + 1, which factorizes as (x^2 + x + 1)(x^2 + x + 1) over GF(2), in other words, 21 = A048720(7,7). As such, it occurs as the 14th term in A091242, reducible polynomials over GF(2), coded in binary.
By definition of this permutation, a(21) is thus obtained as A001969(1+a(14)). 14 in turn is 8th term in A091242, thus a(14) = A001969(1+a(8)). In turn, 8 = A091242(4), thus a(8) = A001969(1+a(4)), and 4 = A091242(1).
By working the recursion back towards the toplevel, the result is a(21) = A001969(1+A001969(1+A001969(1+A001969(1+1)))) = 24.
Consider n=35. In binary it is 100011, encoding for polynomial x^5 + x + 1, which factorizes as (x^2 + x + 1)(x^3 + x^2 + 1) over GF(2), in other words, 35 = A048720(7,13). As such, it occurs as the 26th term in A091242, thus a(35) = A001969(1+a(26)), and as 26 = A091242(18) and 18 = A091242(12) and 12 = A091242(7) and 7 = A014580(3) [the polynomial x^2 + x + 1 is irreducible over GF(2)], and 3 = A014580(2) and 2 = A014580(1), we obtain the result as a(35) = A001969(1+A001969(1+A001969(1+A001969(1+A000069(1+A000069(1+A000069(2))))))) = 136.
		

Crossrefs

Formula

a(1) = 1, and for n > 1, if n is in A014580, a(n) = A000069(1+a(A091226(n))), otherwise a(n) = A001969(1+a(A091245(n))).
As a composition of related permutations:
a(n) = A233280(A245701(n)).
a(n) = A003188(A246201(n)).
a(n) = A234612(A246163(n)).
Other identities:
For all n > 1, A010060(a(n)) = A091225(n). [Maps binary representations of irreducible GF(2) polynomials (A014580) to odious numbers and the corresponding representations of reducible polynomials (A091242) to evil numbers, in some order].

A246162 Permutation of natural numbers: a(1) = 1, a(A000069(n)) = A014580(a(n-1)), a(A001969(n)) = A091242(a(n-1)), where A000069 and A001969 are the odious and evil numbers, and A014580 resp. A091242 are the binary coded irreducible resp. reducible polynomials over GF(2).

Original entry on oeis.org

1, 2, 4, 3, 5, 8, 11, 7, 6, 9, 13, 14, 31, 47, 17, 25, 12, 10, 19, 15, 37, 59, 20, 21, 61, 185, 42, 319, 62, 24, 87, 137, 34, 18, 55, 16, 41, 97, 27, 22, 67, 229, 49, 415, 76, 28, 103, 29, 109, 425, 78, 1627, 222, 54, 283, 3053, 373, 79, 433, 33, 131, 647, 108, 1123, 166, 45, 203, 26, 91, 379, 71, 23
Offset: 1

Views

Author

Antti Karttunen, Aug 17 2014. Erroneous comment corrected Aug 20 2014

Keywords

Comments

This is an instance of entanglement-permutation, where the two complementary pairs to be entangled with each other are A000069/A001969 (odious and evil numbers) and A014580/A091242 (binary codes for irreducible and reducible polynomials over GF(2)).
Because 3 is the only evil number in A014580, it implies that, apart from a(4)=3, all other odious positions contain an odious number. There are also odious numbers in some of the evil positions, precisely all the terms of A246158 in some order, together with all evil numbers larger than 3. (Permutation A246164 has the same property, except there a(7)=3.) See comments in A246161 for more details how this affects the cycle structure of these permutations.

Crossrefs

Formula

a(1) = 1, and for n > 1, if A010060(n) = 1 [i.e. n is one of the odious numbers, A000069], a(n) = A014580(a(A115384(n)-1)), otherwise, a(n) = A091242(a(A245710(n))).
As a composition of related permutations:
a(n) = A245702(A233279(n)).
a(n) = A246202(A006068(n)).
a(n) = A246164(A234612(n)).
For all n > 1, A091225(a(n)) = A010060(n). [Maps odious numbers to binary representations of irreducible GF(2) polynomials (A014580) and evil numbers to the corresponding representations of reducible polynomials (A091242), in some order].

A234613 Self-inverse permutation of nonnegative integers, "gray-blue" code: a(n) = A193231(A003188(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 28 2013

Keywords

Crossrefs

Programs

Formula

a(n) = A193231(A003188(n)).
a(n) = A006068(A193231(n)).
a(n) = A193231(A234612(A193231(n))).
Showing 1-6 of 6 results.