# Rotating Binaries

^{1}

^{2}

^{3}

^{4}

^{5}

^{6}

^{7}

^{*}

## Abstract

**:**

## 1. Introduction

**Definition**

**1.**

- Describing the rotational behavior: Starting point is the diophantine Equation (2). Showing that this diophantine equation always has solutions $a,b$ would answer the question of whether the divisibility holds.
- Unveiling the connection between rotations, cycles, and related concepts: By introducing a boundary feature with Function (6), Halbeisen and Hungerbühler lay the foundation for this, which Cox et al. supplemented with another feature by Function (7). The cycle’s existence depends on this divisibility as stated by Theorem 3.
- Generalizing from $3n+c$ to $kn+c$ cycles: With this generalization, we broaden the field to study the divisibility behavior. Section 9 makes the key contribution to this. We could generalize Theorem 3 for restricting the existence of cycles depending on the divisibility. A proof of this divisibility remains still open.

## 2. Fields of Application

## 3. Binary Rotations Lead Us to 3n + c Cycles

## 4. What We Know about Cycles

**Definition**

**2.**

**Theorem**

**1.**

**Example**

**1.**

**Theorem**

**2.**

**Proof.**

**Theorem**

**3.**

- (a)
- A cycle only exists if the inequality ${2}^{{N}_{1}+{N}_{0}}-{3}^{{N}_{1}}>0$ holds, see [11].
- (b)
- The condition for a cycle’s existence can be detailed as follows [11]: A non-inherited cycle only exists if $c\mid {2}^{{N}_{1}+{N}_{0}}-{3}^{{N}_{1}}$.
- (c)
- Let $0\le {x}_{1}<{x}_{2}<\dots <{x}_{{N}_{1}}\le {N}_{1}-1$ be all positions (the indexing is zero-based) in the parity vector occupied by 1. A $3n+c$ cycle only exists if the divisibility ${2}^{{N}_{1}+{N}_{0}}-{3}^{{N}_{1}}\mid c\xb7z\left(s\right)$ holds, where z is the function given by (3), see [11,12].
- (d)
- The number of $3n+c$ cycles is always less than or equal to the number of $3n+a\xb7c$ cycles, where a is an odd number (this can be deduced from the work of Darrell Cox [11] as well).

**Example**

**2.**

**Theorem**

**4.**

**Proof.**

## 5. Boundary Features of Cycles

**Example**

**3.**

## 6. Constructing One Cycle from Another

**Theorem**

**5.**

## 7. Constant Sums of 3n + c Cycle Members

**Example**

**4.**

**Example**

**5.**

**Example**

**6.**

## 8. Equivalence Classes for a Binary B of Length l

**Example**

**7.**

## 9. Generalizations to kn + c Cycles

#### 9.1. Generalization of Theorem 1

#### 9.2. Generalization of Theorem 2

#### 9.3. Generalization of Theorem 3

- (a)
- A cycle only exists if the inequality ${2}^{{N}_{1}+{N}_{0}}-{k}^{{N}_{1}}>0$ holds.
- (b)
- A cycle only exists if the integer c and the difference ${2}^{{N}_{1}+{N}_{0}}-{k}^{{N}_{1}}$ are not coprime: $gcd(c,{2}^{{N}_{1}+{N}_{0}}-{k}^{{N}_{1}})>1$.
- (c)
- Let $0\le {x}_{1}<{x}_{2}<\dots <{x}_{{N}_{1}}<\le {N}_{1}-1$ be all positions (the indexing is zero-based) in the parity vector occupied by 1. A cycle only exists if the divisibility ${2}^{{N}_{1}+{N}_{0}}-{k}^{{N}_{1}}\mid c\xb7z\left(s\right)$ holds, where z is the function (3).
- (d)
- The number of $kn+c$ cycles is always less than or equal to the number of $kn+a\xb7c$ cycles, where a is an odd number.

#### 9.4. Generalization of Theorem 4

**Proof.**

#### 9.5. Generalizing the Binary Rotations to kn + c Cycles

#### 9.6. More Theorems for kn + c Cycles

**Theorem**

**6.**

**Theorem**

**7.**

## 10. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## Appendix A

Fundamentals short and sweet | |

B | We denote B as a number in base-2 representation (a binary word) of bit-length $l={N}_{1}\left(B\right)+{N}_{0}\left(B\right)$ consisting of ${N}_{1}\left(B\right)$ ones and ${N}_{0}\left(B\right)$ zeros. |

bit-length | The bit-length l of an integer n specifies the number of bits used for the binary representation of this integer. It is given by $l=\lfloor {log}_{2}\left(n\right)\rfloor +1=\lceil {log}_{2}(n+1)\rceil $, see [15]. |

$gde(n,2)$ | The greatest dividing exponent of base 2 with respect to a number n is the largest integer value of k such that ${2}^{k}\mid n$, where ${2}^{k}\le n$, see [7]. |

digit count ${N}_{d}^{2}\left(B\right)$ | The number ${N}_{d}^{2}\left(B\right)={N}_{d}\left(B\right)$ of digits d in the base-2 representation of the number B is called the binary digit count for d. Thus ${N}_{1}\left(B\right)$ specifies the number of ones in B (also termed as Hamming weight of B) given by the difference $B-gde(B!,2)$. Analogously, ${N}_{0}\left(B\right)$ specified the number of zeros in B [5]. |

rotate a binary | The left rotation (left circular shift) of a binary B by r bits is the function ${\lambda}_{\mathrm{left}}(B,r,l)=(B\xb7{2}^{r})\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}({2}^{l}-1))$, where l is the bit-length of B. The right rotation is given by ${\lambda}_{right}(B,r,l)={\lambda}_{\mathrm{left}}(B,l-r,l)$. The bit-length is implicitly given and we can use shorter ${\lambda}_{\mathrm{left}}(B,r)$. |

rotational distance | The left-rotational distance of a binary ${B}_{2}$ from the binary ${B}_{1}$ is the required amount of rotating ${B}_{1}$ (bit by bit) until the rotated binary matches ${B}_{2}$. The right-rotational distance is defined analogously. |

$3n+c$ cycle | We consider the function ${f}_{c}\left(x\right)$ given by Equation (4) and call a cycle the sequence of distinct positive integers $({v}_{1},{v}_{2},\dots ,{v}_{l})$ where ${f}_{c}\left({v}_{1}\right)={v}_{2}$ and ${f}_{c}\left({v}_{2}\right)={v}_{3}$ and so forth and finally ${f}_{c}\left({v}_{l+1}\right)={v}_{1}$. |

$kn+c$ cycle | We generalize $3n+c$ cycles by replacing 3 with any positive integer k. |

periodic sequence | Let $({v}_{1},{v}_{2},\dots ,{v}_{l})$ be a $3n+c$ cycle. We call a sequence that forms a repetition of this cycle $({v}_{1},{v}_{2},\dots ,{v}_{l},{v}_{1},{v}_{2},\dots ,{v}_{l},\dots )$ periodic. |

Primitive cycle | If all members of a $3n+c$ cycle share a same common divisor greater than one, then this cycle is referred to as a non-primitve (inherited or interrelated) cycle, otherwise it is a primitve cycle, see [1]. |

Parity vector | The parity vector of a $3n+c$ cycle $({v}_{1},{v}_{2},\dots ,{v}_{l})$ is a binary vector having $l={N}_{1}+{N}_{0}$ entries – a 1 at position i, if ${v}_{i}$ is odd, and otherwise 0. |

Non-reduced word | Let us consider a $3n+c$ cycle with ${N}_{1}$ odd and ${N}_{0}$ even members. The non-reduced word describing this cycle is a word of length ${N}_{1}+{N}_{0}$ over the alphabet $\{{n}_{1},{n}_{0}\}$, which has a ${n}_{1}$ at those positions, where an odd member and a ${n}_{0}$ where an even member is located in the cycle. For instance, we treat the word ${n}_{1}{n}_{0}{n}_{1}{n}_{1}{n}_{0}{n}_{1}{n}_{0}{n}_{1}$ synonymous to the parity vector $(1,0,1,1,0,1,0,1)$ or even simpler to the binary sequence (binary word) 10110101. |

## References

- Cox, D.; Ghosh, S.; Sultanow, E. Generalizing Halbeisen’s and Hungerbühler’s optimal bounds for the length of Collatz cycles to 3n+c cycles. J. Math. Comput. Sci.
**2021**, 24, 330–337. [Google Scholar] [CrossRef] - Sultanow, E. Data Science for Number and Coding Theory: Divisibility, Periodic Sequences and Discrete Logarithm. Slides from the Talk “Data Science for Number and Coding Theory” at “Code Days 2021”. 2021. Available online: https://www.slideshare.net/Sultanow/data-science-for-number-and-coding-theory-246114021 (accessed on 26 October 2021).
- Grosek, O.; Hromada, V. Rotation-Equivalence classes of binary vectors. Tatra Mt. Math. Publ.
**2016**, 70, 93–98. [Google Scholar] [CrossRef][Green Version] - Sedgewick, R.; Wayne, K. Algorithms, 4th ed.; Addison-Wesley: Upper Saddle River, NJ, USA, 2011. [Google Scholar]
- Weisstein, E.W. “Digit Count.” From MathWorld—A Wolfram Web Resource. Available online: https://mathworld.wolfram.com/DigitCount.html (accessed on 26 October 2021).
- Allouche, J.P.; Shallit, J. Automatic Sequences; Cambridge University Press: Cambridge, UK, 2003. [Google Scholar]
- Weisstein, E.W. “Greatest Dividing Exponent.” From MathWorld—A Wolfram Web Resource. Available online: https://mathworld.wolfram.com/GreatestDividingExponent.html (accessed on 26 October 2021).
- Halbeisen, L.; Hungerbühler, N. Optimal bounds for the length of rational Collatz cycles. Acta Arith.
**1997**, 78, 227–239. [Google Scholar] [CrossRef][Green Version] - Ciet, M.; Farrugia, A.J.; Icart, T. System and Method for a Collatz Based Hash Function. U.S. Patent US 2013/0108038A1, 2 May 2013. [Google Scholar]
- Gupta, A. On Cycles of Generalized Collatz Sequences. arXiv
**2020**, arXiv:2008.11103. [Google Scholar] - Cox, D. The 3n+1 Problem: A Probabilistic Approach. J. Integer. Seq.
**2012**, 15. [Google Scholar] [CrossRef][Green Version] - Böhm, C.; Sontacchi, G. On the existence of cycles of given length in integer sequences like x
_{n+1}= x_{n}/2 if x_{n}even, and x_{n+1}= 3x_{n}+ 1 otherwise. Atti Accad. Naz. Lincei Cl. Sci. Fis. Mat. Nat.**1978**, 64, 260–264. [Google Scholar] - Crandall, R.E. On the “3x+1” problem. Math. Comput.
**1978**, 32, 1281–1292. [Google Scholar] [CrossRef] - Franco, Z.; Pomerance, C. On a conjecture of Crandall concerning the “qx+1” problem. Math. Comput.
**1995**, 64, 1333–1336. [Google Scholar] [CrossRef] - Weisstein, E.W. “Bit Length.” From MathWorld—A Wolfram Web Resource. Available online: https://mathworld.wolfram.com/BitLength.html (accessed on 26 October 2021).

319 | 485 | 734 | 367 | 557 | 842 | 421 | 638 | |
---|---|---|---|---|---|---|---|---|

$\mathbf{319}$ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |

$\mathbf{485}$ | 7 | 0 | 1 | 2 | 3 | 4 | 5 | 6 |

$\mathbf{734}$ | 6 | 7 | 0 | 1 | 2 | 3 | 4 | 5 |

$\mathbf{367}$ | 5 | 6 | 7 | 0 | 1 | 2 | 3 | 4 |

$\mathbf{557}$ | 4 | 5 | 6 | 7 | 0 | 1 | 2 | 3 |

$\mathbf{842}$ | 3 | 4 | 5 | 6 | 7 | 0 | 1 | 2 |

$\mathbf{421}$ | 2 | 3 | 4 | 5 | 6 | 7 | 0 | 1 |

$\mathbf{638}$ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 |

$\mathbf{Word}\mathit{s}$ | $\mathbf{Set}\mathit{\sigma}\left(\mathit{s}\right)\mathbf{of}\mathbf{Left}\mathbf{Rotated}\mathbf{Words}$ | $\left\{\mathit{z}\right(\mathit{t}):\mathit{t}\in \mathit{\sigma}(\mathit{s}\left)\right\}$ | $\underset{\mathit{t}\in \mathit{\sigma}\left(\mathit{s}\right)}{min}\mathit{z}\left(\mathit{t}\right)$ | |
---|---|---|---|---|

$\mathbf{1}$ | 11000 | $11000,10001,00011,00110,01100$ | $5,19,40,20,10$ | 5 |

$\mathbf{2}$ | 10100 | $10100,01001,10010,00101,01010$ | $7,22,11,28,14$ | 7 |

$\mathbf{3}$ | 10010 | $10010,00101,01010,10100,01001$ | $11,28,14,7,22$ | 7 |

$\mathbf{4}$ | 10001 | $10001,00011,00110,01100,11000$ | $19,40,20,10,5$ | 5 |

$\mathbf{5}$ | 01100 | $01100,11000,10001,00011,00110$ | $10,5,19,40,20$ | 5 |

$\mathbf{6}$ | 01010 | $01010,10100,01001,10010,00101$ | $14,7,22,11,28$ | 7 |

$\mathbf{7}$ | 01001 | $01001,10010,00101,01010,10100$ | $22,11,28,14,7$ | 7 |

$\mathbf{8}$ | 00110 | $00110,01100,11000,10001,00011$ | $20,10,5,19,40$ | 5 |

$\mathbf{9}$ | 00101 | $00101,01010,10100,01001,10010$ | $28,14,7,22,11$ | 7 |

$\mathbf{10}$ | 00011 | $00011,00110,01100,11000,10001$ | $40,20,10,5,19$ | 5 |

The largest of all minimum z values is $M(l,n)=M(5,2)=$ | 7 |

B | ${\mathit{v}}_{1}$ | ${\mathit{v}}_{2}$ | ${\mathit{v}}_{3}$ | ${\mathit{v}}_{4}$ | ${\mathit{v}}_{5}$ | $\mathit{Z}\left(\mathit{B}\right)$ | ||
---|---|---|---|---|---|---|---|---|

00001 | = | 1 | 16 | 8 | 4 | 2 | 1 | 31 |

00010 | = | 2 | 8 | 4 | 2 | 1 | 16 | 31 |

00100 | = | 4 | 4 | 2 | 1 | 16 | 8 | 31 |

01000 | = | 8 | 2 | 1 | 16 | 8 | 4 | 31 |

10000 | = | 16 | 1 | 16 | 8 | 4 | 2 | 31 |

$Z\left(B\right)$ = | 31 | 31 | 31 | 31 | 31 |

B | ${\mathit{v}}_{1}$ | ${\mathit{v}}_{2}$ | ${\mathit{v}}_{3}$ | ${\mathit{v}}_{4}$ | ${\mathit{v}}_{5}$ | ${\mathit{v}}_{6}$ | $\mathit{Z}\left(\mathit{B}\right)$ | ||
---|---|---|---|---|---|---|---|---|---|

001001 | = | 9 | 44 | 22 | 11 | 44 | 22 | 11 | 154 |

010010 | = | 18 | 22 | 11 | 44 | 22 | 11 | 44 | 154 |

100100 | = | 36 | 11 | 44 | 22 | 11 | 44 | 22 | 154 |

$\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\xb7Z\left(B\right)=$ | 77 | 77 | 77 | 77 | 77 | 77 |

B | ${\mathit{v}}_{1}$ | ${\mathit{v}}_{2}$ | ${\mathit{v}}_{3}$ | ${\mathit{v}}_{4}$ | ${\mathit{v}}_{5}$ | ${\mathit{v}}_{6}$ | $\mathit{Z}\left(\mathit{B}\right)$ | ||
---|---|---|---|---|---|---|---|---|---|

010101 | = | 21 | 74 | 37 | 74 | 37 | 74 | 37 | 333 |

101010 | = | 42 | 37 | 74 | 37 | 74 | 37 | 74 | 333 |

$\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$3$}\right.\xb7Z\left(B\right)=$ | 111 | 111 | 111 | 111 | 111 | 111 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Gupta, A.; Aberkane, I.J.; Ghosh, S.; Abold, A.; Rahn, A.; Sultanow, E.
Rotating Binaries. *AppliedMath* **2022**, *2*, 104-117.
https://doi.org/10.3390/appliedmath2010005

**AMA Style**

Gupta A, Aberkane IJ, Ghosh S, Abold A, Rahn A, Sultanow E.
Rotating Binaries. *AppliedMath*. 2022; 2(1):104-117.
https://doi.org/10.3390/appliedmath2010005

**Chicago/Turabian Style**

Gupta, Anant, Idriss J. Aberkane, Sourangshu Ghosh, Adrian Abold, Alexander Rahn, and Eldar Sultanow.
2022. "Rotating Binaries" *AppliedMath* 2, no. 1: 104-117.
https://doi.org/10.3390/appliedmath2010005