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

A234748 Self-inverse and multiplicative permutation of natural numbers, A235041-conjugate of Blue code: a(n) = A235042(A193231(A235041(n))).

Original entry on oeis.org

0, 1, 3, 2, 9, 31, 6, 7, 27, 4, 93, 13, 18, 11, 21, 62, 81, 37, 12, 19, 279, 14, 39, 67, 54, 961, 33, 8, 63, 73, 186, 5, 243, 26, 111, 217, 36, 17, 57, 22, 837, 61, 42, 53, 117, 124, 201, 59, 162, 49, 2883, 74, 99, 43, 24, 403, 189, 38, 219, 47, 558, 41, 15, 28, 729, 341, 78, 23, 333
Offset: 0

Views

Author

Antti Karttunen, Dec 31 2013

Keywords

Comments

a(n) has the same prime signature as n: The permutation maps primes to primes, squares to squares, cubes to cubes, and so on.

Examples

			Example of multiplicativity:
a(5)=31, a(11)=13, a(5*11) = a(55) = a(5) * a(11) = 31*13 = 403.
		

Crossrefs

Cf. A234747 for a variant.

Programs

Formula

a(n) = A235042(A193231(A235041(n))).

A245450 Self-inverse permutation of natural numbers, A245703-conjugate of balanced bit-reverse: a(n) = A245704(A057889(A245703(n))).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 13, 8, 9, 10, 19, 12, 7, 14, 15, 16, 53, 18, 11, 20, 21, 22, 23, 24, 25, 26, 27, 33, 41, 30, 113, 32, 28, 34, 35, 36, 47, 39, 38, 92, 29, 54, 163, 85, 45, 462, 37, 60, 49, 70, 51, 94, 17, 42, 55, 74, 57, 156, 193, 48, 101, 62, 115, 64, 259, 77, 73, 132, 69, 50, 181, 102, 67, 56, 169, 76, 66, 78, 137, 87, 180, 398, 139, 84, 44
Offset: 1

Views

Author

Antti Karttunen, Aug 07 2014

Keywords

Crossrefs

Programs

Formula

a(n) = A245704(A057889(A245703(n))).
Other identities. For all n >= 1, the following holds:
A010051(a(n)) = A010051(n). [Maps primes to primes and composites to composites].

A245454 Self-inverse permutation of nonnegative integers, A075158-conjugate of blue code: a(n) = 1 + A075157(A193231(A075158(n-1))).

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 18, 8, 9, 25, 11, 16, 64, 14, 27, 12, 96, 7, 288, 21, 20, 243, 891, 45, 10, 405, 15, 162, 33750, 30, 78650, 75, 625, 2025, 35, 81, 390390, 224, 875, 250, 41, 375, 16384, 270, 24, 300125, 24576, 150, 125, 54, 6125, 1350, 73728, 50, 108, 350, 594, 140777, 5845851, 98, 221433750, 1446445, 343, 13
Offset: 1

Views

Author

Antti Karttunen, Jul 22 2014

Keywords

Crossrefs

Programs

Formula

a(n) = 1 + A075157(A193231(A075158(n-1))).

A234751 Self-inverse permutation of integers induced by the restriction of blue-code to irreducible polynomials over GF(2): a(n) = A091227(A193231(A014580(n))).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 12 2014

Keywords

Comments

This permutation is also induced when A234747 is restricted to primes: a(n) = A000720(A234747(A000040(n))) because of the way A234747 has been defined.
Note that each subsequence a(1)..a(A062692(j)) is closed (i.e., no cycles are leaking out) because blue code (A193231) preserves the degree of polynomials over GF(2) it operates upon.

Crossrefs

Programs

Formula

A244987 Self-inverse permutation of natural numbers, A245703-conjugate of Blue code: a(n) = A245704(A193231(A245703(n))).

Original entry on oeis.org

1, 3, 2, 6, 5, 4, 13, 8, 21, 15, 23, 16, 7, 25, 10, 12, 41, 18, 19, 64, 9, 22, 11, 49, 14, 26, 77, 39, 37, 34, 263, 105, 38, 30, 88, 70, 29, 33, 28, 133, 17, 54, 73, 126, 51, 462, 53, 60, 24, 66, 45, 74, 47, 42, 78, 94, 156, 81, 239, 48, 97, 62, 100, 20, 155, 50, 79, 98, 84, 36, 167, 141, 43, 52, 129, 164, 27, 55
Offset: 1

Views

Author

Antti Karttunen, Aug 07 2014

Keywords

Crossrefs

Programs

Formula

a(n) = A245704(A193231(A245703(n))).
Other identities. For all n >= 1, the following holds:
A010051(a(n)) = A010051(n). [Maps primes to primes and composites to composites].
Showing 1-6 of 6 results.