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

A329325 Irregular triangle read by rows where row n gives the lengths of the components in the Lyndon factorization of the binary expansion of n with first digit removed.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, 1, 4, 2, 1, 1, 2, 2, 3, 1, 4, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, 1, 5, 3, 1, 1, 5, 4, 1, 5, 2, 1
Offset: 1

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).

Examples

			Triangle begins:
   1: ()        21: (22)       41: (23)       61: (1112)
   2: (1)       22: (31)       42: (221)      62: (11111)
   3: (1)       23: (4)        43: (5)        63: (11111)
   4: (11)      24: (1111)     44: (311)      64: (111111)
   5: (2)       25: (13)       45: (32)       65: (6)
   6: (11)      26: (121)      46: (41)       66: (51)
   7: (11)      27: (13)       47: (5)        67: (6)
   8: (111)     28: (1111)     48: (11111)    68: (411)
   9: (3)       29: (112)      49: (14)       69: (6)
  10: (21)      30: (1111)     50: (131)      70: (51)
  11: (3)       31: (1111)     51: (14)       71: (6)
  12: (111)     32: (11111)    52: (1211)     72: (3111)
  13: (12)      33: (5)        53: (122)      73: (33)
  14: (111)     34: (41)       54: (131)      74: (51)
  15: (111)     35: (5)        55: (14)       75: (6)
  16: (1111)    36: (311)      56: (11111)    76: (411)
  17: (4)       37: (5)        57: (113)      77: (6)
  18: (31)      38: (41)       58: (1121)     78: (51)
  19: (4)       39: (5)        59: (113)      79: (6)
  20: (211)     40: (2111)     60: (11111)    80: (21111)
For example, the trimmed binary expansion of 41 is (01001), with Lyndon factorization (01)(001), so row 41 is {2,3}.
		

Crossrefs

Row lengths are A211097.
Row sums are A000523.
Keeping the first digit gives A329314.
Positions of singleton rows are A329327.
Binary Lyndon words are counted by A001037 and ranked by A102659.
Numbers whose reversed binary expansion is a Lyndon word are A328596.
Length of the co-Lyndon factorization of the binary expansion is A329312.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#1]]&]]]];
    Table[Length/@lynfac[Rest[IntegerDigits[n,2]]],{n,100}]

A080541 In binary representation: keep the first digit and left-rotate the others.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Feb 20 2003

Keywords

Comments

Permutation of natural numbers: let r(n,0)=n, r(n,k)=a(r(n,k-1)) for k>0, then r(n,floor(log_2(n))) = n and for n>1: r(n,floor(log_2(n))-1) = A080542(n).
Discarding their most significant bit, binary representations of numbers present in each cycle of this permutation form a distinct equivalence class of binary necklaces, thus there are A000031(n) separate cycles in each range [2^n .. (2^(n+1))-1] (for n >= 0) of this permutation. A256999 gives the largest number present in n's cycle. - Antti Karttunen, May 16 2015

Examples

			a(20)=a('10100')='11000'=24; a(24)=a('11000')='10001'=17.
		

Crossrefs

Inverse: A080542.
The set of permutations {A059893, A080541, A080542} generates an infinite dihedral group.

Programs

  • Maple
    f:= proc(n) local d;
       d:= ilog2(n);
       if n >= 3/2*2^d then 2*n+1-2^(d+1) else 2*n - 2^d fi
    end proc:
    map(f, [$1..100]); # Robert Israel, May 19 2015
  • Mathematica
    A080541[n_] := FromDigits[Join[{First[#]}, RotateLeft[Rest[#]]], 2] & [IntegerDigits[n, 2]];
    Array[A080541, 100] (* Paolo Xausa, May 13 2025 *)
  • Python
    def A080541(n): return ((n&(m:=1< 1 else n  # Chai Wah Wu, Jan 22 2023
  • R
    maxlevel <- 6 # by choice
    a <- 1:3
    for(m in 1:maxlevel) for(k in 0:(2^(m-1)-1)){
    a[2^(m+1)       + 2*k    ] = 2*a[2^m           + k]
    a[2^(m+1)       + 2*k + 1] = 2*a[2^m + 2^(m-1) + k]
    a[2^(m+1) + 2^m + 2*k    ] = 2*a[2^m           + k] + 1
    a[2^(m+1) + 2^m + 2*k + 1] = 2*a[2^m + 2^(m-1) + k] + 1
    }
    a
    # Yosu Yurramendi, Oct 12 2020
    
  • Scheme
    (define (A080541 n) (if (< n 2) n (A003986bi (A053644 n) (+ (* 2 (A053645 n)) (A079944off2 n))))) ;; A003986bi gives the bitwise OR of its two arguments. See A003986.
    ;; Where A079944off2 gives the second most significant bit of n. (Cf. A079944):
    (define (A079944off2 n) (A000035 (floor->exact (/ n (A072376 n)))))
    ;; Antti Karttunen, May 16 2015
    

Formula

From Antti Karttunen, May 16 2015: (Start)
a(1) = 1; for n > 1, a(n) = A053644(n) bitwise_OR (2*A053645(n) + second_most_significant_bit_of(n)). [Here bitwise_OR is a 2-argument function given by array A003986 and second_most_significant_bit_of gives the second most significant bit (0 or 1) of n larger than 1. See A079944.]
Other identities. For all n >= 1:
a(n) = A059893(A080542(A059893(n))).
a(n) = A054429(a(A054429(n))).
(End)
A080542(a(n)) = a(A080542(n)) = n. [A080542 is the inverse permutation.]
From Robert Israel, May 19 2015: (Start)
Let d = floor(log[2](n)). If n >= 3*2^(d-1) then a(n) = 2*n + 1 - 2^(d+1), otherwise a(n) = 2*n - 2^d.
G.f.: 2*x/(x-1)^2 + Sum_{n>=1} x^(2^n)+(2^n-1)*x^(3*2^(n-1)))/(x-1). (End)

A080542 In binary representation: keep the first digit and rotate right the others.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Feb 20 2003

Keywords

Comments

Permutation of natural numbers with inverse = A080541: A080541(a(n)) = a(A080541(n)) = n;
let r(n,0)=n, r(n,k)=a(r(n,k-1)) for k>0, then r(n,floor(log_2(n))) = n and for n>1: r(n,floor(log_2(n))-1) = A080541(n).
Discarding their most significant bit, binary representations of numbers present in each cycle of this permutation form a distinct equivalence class of binary necklaces, thus there are A000031(n) separate cycles in each range [2^n .. (2^(n+1))-1] (for n >= 0) of this permutation. A256999 gives the largest number present in n's cycle. - Antti Karttunen, May 16 2015

Examples

			a(20) = a('10100') = '10010' = 18.
a(25) = a('11001') = '11100' = 28.
		

Crossrefs

Inverse: A080541.
The set of permutations {A059893, A080541, A080542} generates an infinite dihedral group.

Programs

  • Mathematica
    kfd[n_]:=Module[{a,b},{a,b}=TakeDrop[IntegerDigits[n,2],1];FromDigits[ Join[a,RotateRight[b]],2]]; Array[kfd,80] (* The program uses the TakeDrop function from Mathematica version 10 *) (* Harvey P. Dale, Feb 12 2016 *)
  • Python
    def A080542(n): return (1+(n&1))*(1<>1) if n > 1 else n # Chai Wah Wu, Jan 22 2023
  • R
    nmax <- 31 # by choice
    a <- 1:3
    for(n in 1:nmax) for(k in 0:3)
    a[4*n + k] = 2*a[2*n + (k == 1 | k == 3)] + (k == 2 | k == 3)
    a
    # Yosu Yurramendi, Sep 05 2020
    
  • Scheme
    (define (A080542 n) (if (< n 2) n (+ (A053644 n) (+ (* (A000035 n) (A072376 n)) (A004526 (A053645 n))))))  ;; Antti Karttunen, May 16 2015
    

Formula

a(n) = 2^log2(n) + floor((n-2^log2(n))/2) + (n mod 2)*2^(log2(n)-1), where log2(n) is the integer part of base-2 logarithm.
From Antti Karttunen, May 16 2015: (Start)
a(1) = 1; for n > 1, a(n) = A053644(n) + (A000035(n)*A072376(n)) + A004526(A053645(n)). [Essentially the same formula but represented with A-numbers.]
Other identities. For all n >= 1:
a(n) = A059893(A080541(A059893(n))).
a(n) = A054429(a(A054429(n))).
(End)

A256999 a(n)=n for n <= 1; for n >= 2, a(n) = largest number that can be obtained by rotating non-msb bits of binary expansion of n (with A080541 or A080542).

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 6, 7, 8, 12, 12, 14, 12, 14, 14, 15, 16, 24, 24, 28, 24, 26, 28, 30, 24, 28, 26, 30, 28, 30, 30, 31, 32, 48, 48, 56, 48, 52, 56, 60, 48, 52, 52, 58, 56, 58, 60, 62, 48, 56, 52, 60, 52, 58, 58, 62, 56, 60, 58, 62, 60, 62, 62, 63, 64, 96, 96, 112, 96, 104, 112, 120, 96, 100, 104, 114, 112, 116, 120, 124, 96, 104, 100
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Crossrefs

Cf. A257250 (fixed points of this sequence).
Cf. also A163380 (analogous sequence when rotating all bits of binary representation).

A258003 Capped binary boundary codes for holeless strictly non-overlapping polyhexes, only the maximal representative from each equivalence class obtained by rotating.

Original entry on oeis.org

1, 127, 2014, 7918, 31606, 32122, 32188, 126394, 127930, 128476, 486838, 503254, 503482, 505306, 505564, 506332, 511450, 511462, 511708, 511804, 513514, 513772, 513778, 514540, 514804, 514936, 2012890, 2012902, 2013916, 2021098, 2021212, 2022124, 2025196, 2039254, 2043610, 2043622, 2045674, 2045788, 2046700
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

Indexing starts from zero, because a(0) = 1 is a special case, indicating an empty path, which thus ends at the same vertex as where it started from.
A258204(n) gives the count of terms with binary width 2n + 1.

Crossrefs

Intersection of A257250 and A258002.
Subsequence of A258013.
Subsequence: A258005.
Cf. also A258004 (the same terms without the most significant bit, slightly more compact representation).

A258013 Capped binary boundary codes for fusenes, only the maximal representatives of each equivalence class obtained by rotating.

Original entry on oeis.org

1, 127, 2014, 7918, 31606, 32122, 32188, 126394, 127930, 128476, 486838, 503254, 503482, 505306, 505564, 506332, 511450, 511462, 511708, 511804, 513514, 513772, 513778, 514540, 514804, 514936, 2012890, 2012902, 2013916, 2021098, 2021212, 2022124, 2025196, 2039254, 2043610, 2043622, 2045674, 2045788, 2046700
Offset: 0

Views

Author

Antti Karttunen, May 31 2015

Keywords

Comments

A258017(n) gives the count of terms with binary width 2n + 1.
Differs from A258003 for the first time at n=875, which here contains a(875) = 131821024 the smallest polyhex (26 edges, six hexes) where two hexes (at the opposite ends of a coiled pattern) meet to touch each other.
This pattern is isomorphic to benzenoid [6]Helicene (up to chirality, see the illustrations at Wikipedia-page).
Note that here, in contrast to "Boundary Edges Code for Benzenoid Systems" (see links at A258012), if a fusene has no bilateral symmetry then both variants of the corresponding one-sided fusene (their codes) are included in this sequence, the other obtained from the other by turning it over.

Crossrefs

Subsequences: A258003, A258015.
Intersection of A257250 and A258012.
Cf. A258014 (same codes without the most significant bit).
Cf. also A258017.

A328607 Numbers whose reversed binary expansion, without the most significant digit, is a necklace.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 8, 12, 14, 15, 16, 24, 26, 28, 30, 31, 32, 48, 52, 56, 58, 60, 62, 63, 64, 96, 100, 104, 106, 108, 112, 116, 118, 120, 122, 124, 126, 127, 128, 192, 200, 208, 212, 216, 220, 224, 228, 232, 234, 236, 240, 244, 246, 248, 250, 252, 254, 255
Offset: 0

Views

Author

Gus Wiseman, Oct 30 2019

Keywords

Comments

Offset is 0 to be consistent with A257250.
A necklace is a finite sequence that is lexicographically minimal among all of its cyclic rotations.

Examples

			The sequence of terms together with their binary expansions and binary indices begins:
    0:        0 ~ {}
    1:        1 ~ {1}
    2:       10 ~ {2}
    3:       11 ~ {1,2}
    4:      100 ~ {3}
    6:      110 ~ {2,3}
    7:      111 ~ {1,2,3}
    8:     1000 ~ {4}
   12:     1100 ~ {3,4}
   14:     1110 ~ {2,3,4}
   15:     1111 ~ {1,2,3,4}
   16:    10000 ~ {5}
   24:    11000 ~ {4,5}
   26:    11010 ~ {2,4,5}
   28:    11100 ~ {3,4,5}
   30:    11110 ~ {2,3,4,5}
   31:    11111 ~ {1,2,3,4,5}
   32:   100000 ~ {6}
   48:   110000 ~ {5,6}
   52:   110100 ~ {3,5,6}
		

Crossrefs

The dual non-reversed version is A257250.
The dual non-reversed version involving all digits is A065609.
The version involving all digits is A328595.
The non-reversed version is A328668.
Binary necklaces are A000031.

Programs

  • Mathematica
    neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    Select[Range[0,100],#<=1||neckQ[Reverse[Rest[IntegerDigits[#,2]]]]&]

A328668 Numbers whose binary expansion, without the most significant digit, is a necklace.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 8, 9, 11, 15, 16, 17, 19, 21, 23, 31, 32, 33, 35, 37, 39, 43, 47, 63, 64, 65, 67, 69, 71, 73, 75, 77, 79, 85, 87, 91, 95, 127, 128, 129, 131, 133, 135, 137, 139, 141, 143, 147, 149, 151, 155, 157, 159, 171, 175, 183, 191, 255, 256, 257
Offset: 0

Views

Author

Gus Wiseman, Oct 26 2019

Keywords

Comments

Offset is 0 to be consistent with A257250.
A necklace is a finite sequence that is lexicographically minimal among all of its cyclic rotations.

Examples

			The sequence of terms together with their binary expansions and binary indices begins:
   0:       0 ~ {}
   1:       1 ~ {1}
   2:      10 ~ {2}
   3:      11 ~ {1,2}
   4:     100 ~ {3}
   5:     101 ~ {1,3}
   7:     111 ~ {1,2,3}
   8:    1000 ~ {4}
   9:    1001 ~ {1,4}
  11:    1011 ~ {1,2,4}
  15:    1111 ~ {1,2,3,4}
  16:   10000 ~ {5}
  17:   10001 ~ {1,5}
  19:   10011 ~ {1,2,5}
  21:   10101 ~ {1,3,5}
  23:   10111 ~ {1,2,3,5}
  31:   11111 ~ {1,2,3,4,5}
  32:  100000 ~ {6}
  33:  100001 ~ {1,6}
  35:  100011 ~ {1,2,6}
		

Crossrefs

The dual version is A257250.
The version involving all digits, taken in reverse, is A328595.
The reversed version is A328607.
Binary necklaces are A000031.
Necklace compositions are A008965.

Programs

  • Mathematica
    neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    Select[Range[0,100],#<=1||neckQ[Rest[IntegerDigits[#,2]]]&]

A257739 Numbers n for which A256999(n) > n; numbers that can be made larger by rotating (by one or more steps) the non-msb bits of their binary representation (with A080541 or A080542).

Original entry on oeis.org

5, 9, 10, 11, 13, 17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 53, 54, 55, 57, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99, 101, 102, 103, 105, 107, 108, 109, 110, 111
Offset: 1

Views

Author

Antti Karttunen, May 18 2015

Keywords

Comments

Note that A256999(a(n)) is always in A257250.
If we define a co-necklace to be a finite sequence that is lexicographically maximal (not minimal) among all of its cyclic rotations, these are numbers whose binary expansion, without the most significant digit, is not a co-necklace. Numbers whose binary expansion, without the most significant digit, is not a necklace are A329367. - Gus Wiseman, Nov 14 2019

Examples

			For n = 5 with binary representation "101" if we rotate other bits than the most significant bit (that is, only the two rightmost digits "01") one step to either direction we get "110" = 6 > 5, so 5 can be made larger by such rotations and thus 5 is included in this sequence.
For n = 6 with binary representation "110" no such rotation will yield a larger number and thus 6 is NOT included in this sequence.
For n = 10 with binary representation "1010" if we rotate other bits than the most significant bit (that is, only the three rightmost digits "010") either one step to the left or two steps to the right we get "1100" = 12 > 10, thus 10 is included in this sequence.
		

Crossrefs

Complement: A257250.
Numbers whose binary expansion is a necklace are A275692.
Numbers whose binary expansion is a co-necklace are A065609.
Numbers whose reversed binary expansion is a necklace are A328595.
Numbers whose non-msb expansion is a co-necklace are A257250.
Numbers whose non-msb expansion is a necklace are A328668.
Numbers whose reversed non-msb expansion is a necklace are A328607.
Numbers whose non-msb expansion is not a necklace are A329367.
Binary necklaces are A000031.
Necklace compositions are A008965.

Programs

  • Mathematica
    reckQ[q_]:=Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
    Select[Range[2,100],!reckQ[Rest[IntegerDigits[#,2]]]&] (* Gus Wiseman, Nov 14 2019 *)

A258209 Numbers k for which A256999(A059893(k)) = k.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 8, 12, 14, 15, 16, 24, 26, 28, 30, 31, 32, 48, 52, 56, 58, 60, 62, 63, 64, 96, 100, 104, 106, 112, 118, 120, 122, 124, 126, 127, 128, 192, 200, 208, 212, 224, 228, 234, 236, 240, 246, 248, 250, 252, 254, 255, 256, 384, 392, 400, 416, 420, 424, 426, 448, 460, 466, 472, 474, 480, 484, 490, 494, 496, 502, 504, 506, 508, 510, 511, 512
Offset: 0

Views

Author

Antti Karttunen, May 31 2015

Keywords

Comments

Indexing starts from zero, because a(0) = 0 is a special case.
These numbers correspond to the maximal (lexicographically largest) representatives selected from each equivalence class of those binary necklaces that stay the same (in the same equivalence class) when flipped over (which thus have a bilateral symmetry, please see the examples). A029744(n) gives the number of terms with n significant bits in their binary representation.

Examples

			28 ("11100" in binary) is in sequence, because after removing the most significant bit, the binary string "1100" when reversed, "0011", can then be rotated (two steps in either direction) to give "1100" again and "1100" is the lexicographically largest of these rotations.
114 ("1110010" in binary) is NOT in the sequence, because after removing the most significant bit, the binary string "110010" when reversed, "010011", does not yield "110010" no matter how many steps it is rotated (even though it is the lexicographically largest rotation of its class). Thus although 114 is in A257250 (a supersequence of this sequence), it is not included here.
		

Crossrefs

Subsequence of A257250.
Differs from A257250 for the first time at n=31, where a(31) = 118, while A257250(31) = 114.
Showing 1-10 of 10 results.