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

A377292 Terms of A118666 as produced by the program given there (without the final sorting).

Original entry on oeis.org

0, 1, 6, 7, 20, 18, 21, 19, 120, 108, 126, 106, 121, 109, 127, 107, 272, 360, 260, 380, 278, 366, 258, 378, 273, 361, 261, 381, 279, 367, 259, 379, 1632, 1904, 1560, 1800, 1652, 1892, 1548, 1820, 1638, 1910, 1566, 1806, 1650, 1890, 1546, 1818, 1633, 1905, 1561, 1801
Offset: 0

Views

Author

DarĂ­o Clavijo, Dec 27 2024

Keywords

Crossrefs

Programs

  • Python
    A048726 = lambda n: (n << 2) ^ (n << 1)
    def a(n):
        if n == 0: return 0
        f, s = 1, n
        while s > 1:
            f = A048726(f) | (s & 1)
            s >>= 1
        return f
    print([a(n) for n in range(0, 52)])

Formula

a(2^k) = A117998(k).

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

A280502 a(n) = A280500(n, A280501(n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 1, 1, 8, 3, 3, 11, 2, 13, 2, 15, 16, 17, 1, 1, 1, 1, 22, 23, 4, 25, 26, 5, 4, 29, 5, 31, 32, 33, 15, 13, 2, 37, 2, 39, 2, 41, 2, 43, 44, 15, 13, 47, 8, 11, 50, 51, 52, 3, 3, 55, 8, 57, 11, 59, 3, 61, 62, 3, 64, 5, 31, 67, 5, 69, 26, 71, 4, 73, 74, 75, 4, 77, 29, 25, 4, 81, 82, 29, 4, 85, 25, 87, 88, 89, 5, 91, 26, 31, 94, 5, 16, 97, 22, 99, 100, 23, 17
Offset: 1

Views

Author

Antti Karttunen, Jan 09 2017

Keywords

Crossrefs

Cf. A118666 (positions of ones).

Programs

Formula

a(n) = A280500(n, A280501(n)).
Other identities. For all n >= 1:
A048720(a(n), A280501(n)) = n.

A117998 Decimal number generated by the binary bits of the n-th generation of the Rule 102 elementary cellular automaton.

Original entry on oeis.org

1, 6, 20, 120, 272, 1632, 5440, 32640, 65792, 394752, 1315840, 7895040, 17895424, 107372544, 357908480, 2147450880, 4295032832, 25770196992, 85900656640, 515403939840, 1168248930304, 7009493581824, 23364978606080
Offset: 0

Views

Author

Eric W. Weisstein, Apr 08 2006

Keywords

Comments

Central diagonal of A099884 when viewed as a square array. Thus also a subsequence of A118666. - Antti Karttunen, Jan 18 2020

Examples

			1; 1, 1, 0; 1, 0, 1, 0, 0; 1, 1, 1, 1, 0, 0, 0; 1, 0, 0, 0, 1, 0, 0, 0, 0; ...
		

Crossrefs

Iterates of A048726, starting from a(0) = 1.
Central diagonal of A099884. Bisection of A099885. Subsequence of A118666.

Programs

  • Mathematica
    NestList[BitXor[4#,2#]&,1,50] (* Paolo Xausa, Oct 04 2023 *)
  • PARI
    A117998(n) = (subst(lift(Mod(1+'x, 2)^n), 'x, 2)<Antti Karttunen, Jan 19 2020, after Gheorghe Coserea's code for A001317.
    
  • Python
    def A117998(n): return sum((bool(~n&n-k)^1)<Chai Wah Wu, May 03 2023

Formula

It appears that a(n) = A099885(2*n). - Peter Bala, Feb 01 2017
From Antti Karttunen, Jan 19 2020: (Start)
Bala's observation is correct, and follows from the formula given below and from the fact that this is the central diagonal of square array A099884.
a(n) = A000079(n) * A001317(n). [See Eric Weisstein's World of Mathematics -link]
a(0) = 1; for n > 0, a(n) = A048726(a(n-1)).
(End)

A234749 Fixed points of permutation A234746.

Original entry on oeis.org

3, 12, 13, 14, 85, 86, 87, 96, 97, 102, 103, 216, 217, 218, 219, 230, 231, 236, 237, 308, 313, 314, 323, 324, 325, 1370, 1371, 1372, 1373, 1382, 1383, 1388, 1389, 1446, 1447, 1452, 1453, 1464, 1465, 1466, 1467, 1600, 1601, 1606, 1615, 1616, 1617, 1678, 1679, 1680, 1691, 1692, 1697, 1698
Offset: 1

Views

Author

Antti Karttunen, Feb 15 2014

Keywords

Comments

A234752 gives the corresponding binary encodings for those reducible GF(2)[X] polynomials that are fixed by blue code (A193231).
Fixed points of A234751 seem to be rarer. The first 22 values are: 3, 6, 21, 52, 55, 200, 203, 212, 461, 462, 479, 480, 483, 2150, 2151, 2176, 2177, 2190, 2195, 2208, 2209, 2214.

Crossrefs

A280507 a(n) = n XOR A193231(n).

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 0, 0, 7, 7, 6, 6, 6, 6, 7, 7, 1, 1, 0, 0, 0, 0, 1, 1, 6, 6, 7, 7, 7, 7, 6, 6, 19, 19, 18, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 21, 20, 20, 18, 18, 19, 19, 19, 19, 18, 18, 21, 21, 20, 20, 20, 20, 21, 21, 21, 21, 20, 20, 20, 20, 21, 21, 18, 18, 19, 19, 19, 19, 18, 18, 20, 20, 21, 21, 21, 21, 20, 20, 19, 19, 18, 18, 18, 18, 19, 19, 6, 6
Offset: 0

Views

Author

Antti Karttunen, Jan 09 2017

Keywords

Crossrefs

Cf. A118666 (positions of zeros).

Programs

Formula

a(n) = A003987(n,A193231(n)) = n XOR A193231(n).
Other identities. For all n >= 0:
a(A193231(n)) = a(n).

A234752 Binary encodings of reducible polynomials over GF(2)that are fixed by blue code: a(n) = A091242(A234749(n)).

Original entry on oeis.org

6, 18, 20, 21, 106, 107, 108, 120, 121, 126, 127, 258, 259, 260, 261, 272, 273, 278, 279, 360, 366, 367, 378, 380, 381, 1546, 1547, 1548, 1549, 1560, 1561, 1566, 1567, 1632, 1633, 1638, 1639, 1650, 1651, 1652, 1653, 1800, 1801, 1806, 1818, 1819, 1820, 1890, 1892, 1893, 1904, 1905, 1910, 1911
Offset: 1

Views

Author

Antti Karttunen, Feb 15 2014

Keywords

Comments

Irreducible polynomials over GF(2) (A014580) fixed by blue code (A193231) seem to be much rarer. The first 22 cases are: 7, 19, 109, 361, 379, 1807, 1821, 1891, 4645, 4663, 4897, 4915, 4941, 27327, 27329, 27589, 27607, 27829, 27851, 28067, 28081, 28125.

Crossrefs

Intersection of A091242 and A118666.

Programs

Formula

a(n) = A091242(A234749(n)).
Showing 1-7 of 7 results.