Comments on Juggler sequences
Post
Juggler sequences
A Juggler sequence is a sequence that begins with a positive integer $a_0$ and each subsequent term is calculated as:
$$a_{k+1} = \begin{cases}
\left \lfloor a_k ^ \frac 1 2 \right \rfloor, & \text{if } a_k \text{ is even}\\
\left \lfloor a_k ^ \frac 3 2 \right \rfloor, & \text{if } a_k \text{ is odd}
\end{cases}$$
Eventually, once $a_k$ equals $1$, the sequence ends, as all subsequent terms will be $1$. It has been conjectured, but not proven, that all Juggler sequences reach 1.
Given a positive integer $n \ge 2$, output the Juggler sequence beginning with $a_0 = n$ and ending in $1$. You may assume it will always terminate. You should only output a single $1$, and the sequence should be in calculated order ($a_0, a_1, a_2,$ etc.)
This is code-golf, so the shortest code in bytes wins
Test cases
2: 2, 1
3: 3, 5, 11, 36, 6, 2, 1
4: 4, 2, 1
5: 5, 11, 36, 6, 2, 1
6: 6, 2, 1
7: 7, 18, 4, 2, 1
8: 8, 2, 1
9: 9, 27, 140, 11, 36, 6, 2, 1
10: 10, 3, 5, 11, 36, 6, 2, 1
[Jelly], 7 bytes Ḃ×½ḞµƬ …
3y ago
BQN, 17 bytesSBCS ``` {𝕩∾1 …
3y ago
Scala, 78 67 64 bytes Saved …
3y ago
[Husk], 11 10 bytes U¡λ …
3y ago
JavaScript (Node.js), 73 66 by …
3y ago
[APL (Dyalog Unicode)], 15 byt …
3y ago
Japt, 17 bytes Needs some m …
3y ago
JavaScript, 37 32 bytes Out …
3y ago
[Python 3], 64 bytes …
3y ago
1 comment thread