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.

A257250 Numbers n for which A256999(n) = n; numbers that cannot be made any 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

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, 114, 116, 118, 120, 122, 124, 126, 127, 128, 192, 200, 208, 212, 224, 226, 228, 232, 234, 236, 240, 242, 244, 246, 248, 250, 252, 254, 255, 256, 384, 392, 400, 416, 420, 424, 426, 448, 450
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

These correspond to the maximal (lexicographically largest) representatives selected from each equivalence class of binary necklaces. See the last example.
Indexing starts from zero, because a(0) = 0 is a special case.
If k is a member then so also is 2*k, i.e., k with 0 appended to the end of its binary representation.
If k is a member then so also is A004755(k), i.e., k with 1 prepended to the front of its binary representation.
One obtains A065609 if one erases the most significant bit of each term [as A053645(a(n))] and then discards any zero-terms produced from the terms that originally were powers of two (A000079).
First differs from A328607 in lacking 108, with binary expansion 1101100. If we define a dual-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 a dual-necklace. - Gus Wiseman, Nov 04 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 is NOT included in this sequence.
For n = 6, with binary representation "110", no such rotation will yield a larger number, and thus 6 is included in this sequence.
For n = 28, with binary representation "11100", if we rotate non-msb bits towards right, we get additional numbers 22, 19 and 25 (with binary representations "10110", "10011", "11001") before coming to 28 again, and 28 is the largest of these numbers, thus 28 is included in this sequence.
  Also, if we discard the most significant bit of each and consider them just as binary strings, then A053645(28) = 12 is the lexicographically largest representative of {"1100", "0110", "0011", "1001"}, which is the complete set of representatives for a particular equivalence class of binary necklaces, obtained by rotating all bits of binary string "1100" successively towards right or left.
		

Crossrefs

Complement: A257739.
Odd terms: A000225.
Subsequence of A065609.
Subsequence: A258003.
The non-dual version is A328668.
The version involving all digits is A065609.
The non-dual reversed version is A328607.
Numbers whose reversed binary expansion is a necklace are A328595.
Binary necklaces are A000031.
Necklace compositions are A008965.

Programs

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

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 *)

A257697 a(n)=0 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), without the most significant bit of n: a(n) = A053645(A256999(n)).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 2, 3, 0, 4, 4, 6, 4, 6, 6, 7, 0, 8, 8, 12, 8, 10, 12, 14, 8, 12, 10, 14, 12, 14, 14, 15, 0, 16, 16, 24, 16, 20, 24, 28, 16, 20, 20, 26, 24, 26, 28, 30, 16, 24, 20, 28, 20, 26, 26, 30, 24, 28, 26, 30, 28, 30, 30, 31, 0, 32, 32, 48, 32, 40, 48, 56, 32, 36, 40, 50, 48, 52, 56, 60, 32, 40, 36, 52, 40, 42, 50, 58, 48, 50, 52, 54, 56, 58, 60
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

For each n, apart from powers of 2, a(n) gives the lexicographically largest representative from the equivalence class of binary necklaces obtained by successively rotating (with A080541 or A080542) all the other bits than the most significant bit in the binary representation of n.

Crossrefs

Programs

Formula

a(n) = A053645(A256999(n)).
Other identities and observations:
For all n >= 0, a(n) >= A053645(n).
Apart from powers of 2 (A000079), for any other n, a(n) >= A072376(n).

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.

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)

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).

A163380 a(n) = the (decimal equivalent of the) largest integer that can be made by rotating the binary digits of n any number of positions to the left or right.

Original entry on oeis.org

1, 2, 3, 4, 6, 6, 7, 8, 12, 10, 14, 12, 14, 14, 15, 16, 24, 20, 28, 20, 26, 26, 30, 24, 28, 26, 30, 28, 30, 30, 31, 32, 48, 40, 56, 36, 50, 52, 60, 40, 52, 42, 58, 50, 54, 58, 62, 48, 56, 50, 60, 52, 58, 54, 62, 56, 60, 58, 62, 60, 62, 62, 63, 64, 96, 80, 112, 72, 98, 104, 120
Offset: 1

Views

Author

Leroy Quet, Jul 25 2009

Keywords

Comments

By rotating the binary digits of n, it is meant: Write n in binary without any leading 0's. To rotate this string to the right, say, by one position, first remove the rightmost digit and then append it on the left side of the remaining string. (So the least significant digit becomes the most significant digit.) Here, leading 0's are not removed after the first rotation, so that each binary string being rotated has the same number of binary digits as n has.

Examples

			13 in binary is 1101. Rotating this just once to the right, we get 1110, 14 in decimal. If we rotate twice to the right, we would have had 0111 = 7 in decimal. Rotating 3 times, we end up with 1011, which is 11 in decimal. Rotating 4 times, we end up at the beginning with 1101 = 13. 14 is the largest of these, so a(13) = 14.
		

Crossrefs

Programs

  • Maple
    rot := proc(n,t) convert(n,base,2) ; bdgs := ListTools[Rotate](%,t) ; add(op(i,bdgs)*2^(i-1),i=1..nops(bdgs)) ; end: A163380 := proc(n) local a,r; a := n ; for r from 1 to ilog2(n) do a := max(a, rot(n,r)) ; od: a; end: seq(A163380(n),n=1..100) ; # R. J. Mathar, Aug 03 2009
  • Mathematica
    Table[With[{d = IntegerDigits[n, 2]}, Max@ Map[FromDigits[#, 2] &@ RotateRight[d, #] &, Range[Length@ d]]], {n, 71}] (* Michael De Vlieger, Sep 23 2017 *)

Extensions

More terms from R. J. Mathar, Aug 03 2009

A258015 Capped binary boundary codes for those fusenes that stay same when flipped over, only the maximal representative from each equivalence class up to rotation.

Original entry on oeis.org

1, 127, 2014, 7918, 31606, 32122, 32188, 126394, 486838, 503482, 505564, 506332, 511708, 511804, 513514, 514936, 2012890, 2021098, 2025196, 2054044, 2055544, 7788250, 8050522, 8051434, 8051548, 8054620, 8075098, 8075110, 8084380, 8104888, 8182636, 8183020, 8185756, 8207218, 8207602, 8214442, 8219596, 8219602, 8231884, 8236516, 8238832
Offset: 0

Views

Author

Antti Karttunen, Jun 01 2015

Keywords

Comments

These are binary boundary codes for fusenes with bilateral symmetry, i.e., those terms k in A258013 for which A256999(A059893(k)) = k. A258018(n) gives the count of terms with binary width 2n + 1.
Differs from its subsequence A258005 for the first time at n=113, as a(113) = 131821024 is the first term not present in A258005.

Crossrefs

Subsequence of A258013.
Subsequence: A258005.
Cf. A258018.

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

Original entry on oeis.org

1, 127, 2014, 7918, 31606, 32122, 32188, 126394, 486838, 503482, 505564, 506332, 511708, 511804, 513514, 514936, 2012890, 2021098, 2025196, 2054044, 2055544, 7788250, 8050522, 8051434, 8051548, 8054620, 8075098, 8075110, 8084380, 8104888, 8182636, 8183020, 8185756, 8207218, 8207602, 8214442, 8219596, 8219602, 8231884, 8236516
Offset: 0

Views

Author

Antti Karttunen, May 31 2015

Keywords

Comments

Indexing starts from zero, because a(0) = 1 is a special case, indicating an empty path in the honeycomb lattice.
These are capped binary boundary codes for those holeless polyhexes that stay same when they are flipped over and rotated appropriately.
A258205(n) gives the count of terms with binary width 2n + 1.

Crossrefs

Intersection of A258003 and A258209. Differs from A258003 for the first time at n=8, where a(8) = 486838 while A258003(8) = 127930.
Subsequence of A258015 from which this differs for the first time at n=113.
Showing 1-10 of 10 results.