[Question]
  [
The [Juggler sequence](https://en.wikipedia.org/wiki/Juggler_sequence) is described as follows. Beginning with an input \$a\_1\$, the next term is defined by the recurrence relation
$$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}$$
The sequence terminates when it reaches 1, as all subsequent terms would then be 1.
## Task
Given an input \$n\$ greater than or equal to 2, write a program/function/generator/etc. that outputs/returns the respective juggler sequence. The output can be in any reasonable form. You may not use a built-in that computes the juggler sequence, or any built-in that directly yields the result. You may assume that the sequence terminates in \$1\$.
## Test Cases
```
Input: output
2: 2, 1
3: 3, 5, 11, 36, 6, 2, 1
4: 4, 2, 1
5: 5, 11, 36, 6, 2, 1
```
This is a code golf. Shortest code in bytes wins.
  
[Answer]
# Julia, ~~64~~ ~~50~~ ~~48~~ ~~42~~ ~~32~~ 30 bytes
```
g(x)=[x;x<3||g(x^(x%2+.5)√∑1)]
```
This is a recursive function that accepts an integer and returns a float array.
We build an array by concatenating the input with the next term of the sequence, computed as *x* to the power of its parity plus 1/2. This gives us either *x*1/2 or *x*1+1/2 = *x*3/2. Integer division by 1 gets the floor. When the condition *x* < 3 is true, the final element will be a Boolean rather than a numeric value, but since the array is not of type `Any`, this is cast to have the same type as the rest of the array.
Saved 14 bytes thanks to Dennis!
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~12~~ ~~11~~ 10 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
*B·π™√ó¬Ω·∏û¬µ‚Äô√ê¬ø
```
*Thanks to @Sp3000 for golfing off 1 byte!*
[Try it online!](http://jelly.tryitonline.net/#code=KkLhuarDl8K94biewrXigJnDkMK_&input=&args=Mw)
### How it works
```
*B·π™√ó¬Ω·∏û¬µ‚Äô√ê¬ø    Main link. Input: n
*B            Elevate n to all of its digits in base 2.
  ·π™           Extract the last power.
              This yields n ** (n % 2).
   √ó¬Ω         Multiply with sqrt(n). This yields n ** (n % 2 + 0.5).
     ·∏û        Floor.
      ¬µ       Push the previous chain on the stack and begin a new, monadic chain.
        √ê¬ø    Repeat the previous chain while...
       ‚Äô        n - 1 is non-zero.
              Collect all intermediate results in an array.
```
[Answer]
# JavaScript (ES7), ~~45~~ 33 bytes
```
f=n=>n<2?n:n+","+f(n**(.5+n%2)|0)
```
## Explanation
Recursive approach. Returns a comma-separated string of numbers.
```
f=n=>
  n<2?n:          // stop when n == 1
  n               // return n at the start of the list
  +","+f(         // add the rest of the sequence to the list
    n**(.5+n%2)|0 // juggler algorithm
  )
```
## Test
`**` not used in test for browser compatibility.
```
f=n=>n<2?n:n+","+f(Math.pow(n,.5+n%2)|0)
```
```
<input type="number" oninput="result.textContent=f(+this.value)" />
<pre id="result"></pre>
```
[Answer]
# Mathematica, ~~40~~ 39 bytes
*Thanks to Martin B√ºttner for saving 1 byte.*
```
NestWhileList[‚åä#^.5#^#~Mod~2‚åã&,#,#>1&]&
```
**Test case**
```
%[5]
(* {5,11,36,6,2,1} *)
```
[Answer]
# Pyth, ~~14~~ 12 bytes
```
.us@*B@N2NNQ
```
[Demonstration](https://pyth.herokuapp.com/?code=.us%40%2aB%40N2NNQ&input=3&debug=0)
We start with a cumulative reduce, `.u`, which in this case starts at the input and applies a function until the result repeats, at which point it outputs all of the intermediate results.
The function takes the previous value as `N`. It starts by taking its square root with `@N2`. Next, it bifurcates that value on multiplication by `N` with `*B ... N`. This creates the list `[N ** .5, (N ** .5) * N]`, the unfloored results for the even and odd cases. Next, the appropriate unfloored result is selected by indexing into the list with `@ ... N`. Since Pyth has modular indexing, no out-of-bounds errors are thrown. Finally, the result is floored with `s`.
[Answer]
# MATL, ~~13~~ 12 bytes
```
`tt2\.5+^ktq
```
[Try it online!](http://matl.tryitonline.net/#code=YHR0MlwuNSteWm90cQ&input=NQ)
Explanation
```
`     % do...while loop
tt   % duplicate top of stack twice, takes implicit input on first iteration
2\    % take a_k mod 2
.5+^  % adds 0.5, to give 1.5 if odd, 0.5 if even, and takes a_k^(0.5 or 1.5)
kt    % Rounds down, and duplicates
q     % Decrement by 1 and use for termination condition---if it is 0, loop will finish
```
Thanks Luis for saving a byte!
[Answer]
## [Minkolang 0.15](https://github.com/elendiastarman/Minkolang), 25 bytes
```
ndN(d$7;r2%2*1+;YdNd1=,).
```
[Try it here!](http://play.starmaninnovations.com/minkolang/?code=ndN%28d%247%3Br2%252*1%2B%3BYdNd1%3D%2C%29%2E&input=3)
### Explanation
```
n                            Take number from input => n
 dN                          Duplicate and output as number
   (                         Open while loop
    d                        Duplicate top of stack => n, n
     $7                      Push 0.5
       ;                     Pop b,a and push a**b => n, sqrt(n)
        r                    Reverse stack => sqrt(n), n
         2%                  Modulo by 2
           2*                Multiply by 2
             1+              Add 1 => sqrt(n), [1 if even, 3 if odd]
               ;             Pop b,a and push a**b => sqrt(n)**{1,3}
                Y            Floor top of stack
                 dN          Duplicate and output as number
                   d1=,      Duplicate and => 0 if 1, 1 otherwise
                       ).    Pop top of stack and end while loop if 0, then stop.
```
[Answer]
## TSQL, 89 bytes
Input goes in `@N`:
```
DECLARE @N INT = 5;
```
Code:
```
WITH N AS(SELECT @N N UNION ALL SELECT POWER(N,N%2+.5) N FROM N WHERE N>1)SELECT * FROM N
```
[Answer]
# APL, ~~28~~ ~~24~~ 16 bytes
```
{‚åä‚çµ*.5+2|‚éï‚Üê‚çµ}‚ç£=‚éï
```
This is a program that accepts an integer and prints the successive outputs on separate lines.
Explanation:
```
{           }‚ç£=‚éï   ‚çù Apply the function until the result is the input
 ‚åä‚çµ*.5+2|‚éï‚Üê‚çµ       ‚çù Print the input, compute floor(input^(input % 2 + 0.5))
```
[Try it online](http://ngn.github.io/apl/web/#code=%7B%u230A%u2375*.5+2%7C%u2395%u2190%u2375%7D%u2363%3D%u2395)
Saved 8 bytes thanks to Dennis!
[Answer]
## Java 7, ~~83~~ 71 bytes
```
void g(int a){System.out.println(a);if(a>1)g((int)Math.pow(a,a%2+.5));}
```
I originally used a typical `for` loop, but I had to jump through hoops to get it working right. After ~~stealing~~ borrowing [user81655's idea](https://codegolf.stackexchange.com/a/73138/14215) to recurse instead, I got it down twelve bytes.
[Answer]
# Haskell, 70 bytes
Haskell doesn't have integer `sqrt` built-in, but I think there may be something shorter than `floor.sqrt.fromInteger`.
```
s=floor.sqrt.fromInteger
f n|odd n=s$n^3|1<2=s n
g 1=[1]
g n=n:g(f n) 
```
[Answer]
# Oracle SQL 11.2, 128 bytes
```
WITH v(i)AS(SELECT :1 FROM DUAL UNION ALL SELECT FLOOR(DECODE(MOD(i,2),0,SQRT(i),POWER(i,1.5)))FROM v WHERE i>1)SELECT i FROM v;
```
Un-golfed
```
WITH v(i) AS
(
  SELECT :1 FROM DUAL
  UNION ALL
--  SELECT FLOOR(POWER(i,0.5+MOD(i,2))) FROM v WHERE i>1
  SELECT FLOOR(DECODE(MOD(i,2),0,SQRT(i),POWER(i,1.5))) FROM v WHERE i>1 
)
SELECT * FROM v;
```
Adding MOD(i,2) to .5 is shorter but there is a bug with POWER(2,.5) :
```
SELECT POWER(4,.5), FLOOR(POWER(4,.5)), TO_CHAR(POWER(4,.5)) FROM DUAL
```
gives
```
2   1   1,99999999999999999999999999999999999999
```
[Answer]
# R, ~~54~~  51 bytes
```
z=n=scan();while(n>1){n=n^(.5+n%%2)%/%1;z=c(z,n)};z
```
Saved 3 bytes thanks to plannapus. 
[Answer]
# CJam, 18 bytes
```
ri{__2%.5+#i_(}g]p
```
[**Test it here**](http://goo.gl/qI5alq)
Similar to [David's MATL answer](https://codegolf.stackexchange.com/a/73131/36398).
[Answer]
# Python 3, ~~57~~, ~~45~~, ~~43~~, 41 bytes
Better Solution with suggestion from @mathmandan
```
def a(n):print(n);n<2or a(n**(.5+n%2)//1)
```
This method will print each number on a new line
Previous Solution: Cut down to 43 bytes after xnor's recommendation
```
a=lambda n:[n][:n<2]or[n]+a(n**(n%2+.5)//1)
```
You can call the above by doing `a(10)` which returns `[10, 3.0, 5.0, 11.0, 36.0, 6.0, 2.0, 1.0]`
The above will output the values as floats. If you want them as integers, then we can just add an extra 2 bytes for 43 bytes:
```
def a(n):print(n);n<2or a(int(n**(.5+n%2)))
```
[Answer]
## TI-Basic, 30 Bytes
```
Prompt A
Repeat A=1
Disp A
int(A^(remainder(A,2)+.5->A
End
1
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 10 bytes
```
Œª‚à∑d‚Ä∫¬Ωe‚åä;ƒ∞J
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLOu+KIt2TigLrCvWXijIo7xLBKIiwiIiwiNSJd)
[Answer]
# JavaScript ES6, ~~109~~ 102 bytes
```
s=>(f=n=>n==1?n:n%2?Math.pow(n,3/2)|0:Math.sqrt(n)|0,a=[s],eval("while(f(s)-1)a.push(s=f(s))"),a+",1")
```
I *know* this can be golfed. Returns a string of comma-separated numbers.
[Answer]
# C++, 122 bytes
```
#include <iostream>
void f(int n){int i;while(n^1){std::cout<<n<<',';for(i=n*n;i*i>(n%2?n*n*n:n);i--);n=i;}std::cout<<1;}
```
[Answer]
# Retina, 144 bytes
Input and output are in unary.
The 2nd-to-last line contains a space, and the two middle lines and the last line are empty.
```
{`(\b|)11+$
$&¬∂$&
m-1=`^(?=^(11)*(1?)).*$
$&,$2
(1+),1$
$1;,
1(?=1*;)
$%_
1+;
$%_
;|,
m-1=`^
1:
+`(1+):(11\1)
1 $2:
1+:$|:1+
-1=`(1+\b)
$#1
 
```
[**Try it online**](http://retina.tryitonline.net/#code=e2AoXGJ8KTExKyQKJCbCtiQmCm0tMT1gXig_PV4oMTEpKigxPykpLiokCiQmLCQyCigxKyksMSQKJDE7LAoxKD89MSo7KQokJV8KMSs7CiQlXwo7fCwKCm0tMT1gXgoxOgorYCgxKyk6KDExXDEpCjEgJDI6CjErOiR8OjErCgotMT1gKDErXGIpCiQjMQogCg&input=MTEx)
### Explanation
```
{`(\b|)11+$                 # Loop, Duplicate last line
$&¬∂$&
m-1=`^(?=^(11)*(1?)).*$     # Append ,n%2 to that line (number modulo 2)
$&,$2
(1+),1$                     # Cube that number if odd
$1;,
1(?=1*;)
$%_
1+;
$%_
;|,                         # (Last stage of cubing number)
m-1=`^                      # Integer square root of that number, 
1:                          #   borrowed and modified from another user's answer
+`(1+):(11\1)
1 $2:
1+:$|:1+
-1=`(1+\b)
$#1
 
```
[Integer square root in Retina](https://codegolf.stackexchange.com/a/82632/34718), by Digital Trauma
[Answer]
# C, ~~64~~ ~~63~~ 61 bytes
```
t;q(n){for(;!t;n=pow(n,.5+n%2))printf("%d%c ",n,n^1?44:t++);}
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~14~~ 12 bytes
```
U¬°o‚åä?^1.5‚àö%2
```
[Try it online!](https://tio.run/##yygtzv7/P/TQwvxHPV32cYZ6po86Zqka/f//3xQA "Husk ‚Äì Try It Online")
## Explanation
```
U¬°»Ø‚åä?^1.5‚àö%2
 ¬°             iterate over the input infinitely, creating a list
  »Ø            with the following three functions:
               take the previous result
          %2   modulo 2
    ?^1.5      if truthy, raise to 3/2th power
         ‚àö     else take square root
   ‚åä           floor the result
U              cut the list at fixed point
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~12~~ 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Œî=D√â¬∑>;m√Ø
```
-3 bytes thanks to *@ovs*.
Outputs each result on a separate line.
[Try it online](https://tio.run/##yy9OTMpM/f//3BQX28Odh7bbWeceXv//vzEA) or [verify some more test cases](https://tio.run/##yy9OTMpM/R8ZcnRHmZJnXkFpiZWCkn2lDpeSf2kJhKdT@f/cFFuXw52HtttZ5x5e/7/20Db7/wA).
**Explanation:**
```
Œî          # Loop until the result no longer changes:
 =         #  Print the current value with trailing newline (without popping)
           #  (which will be the implicit input-integer in the first iteration)
  D        #  Duplicate the value
   √â       #  Pop the copy, and check if it's odd (1 if odd; 0 if even)
    ¬∑      #  Double that
     >     #  Increase it by 1
      ;    #  Halve it
       m   #  Take the current value to the power this 1/2 or 3/2
        √Ø  #  And then cast it to an integer to floor it
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
*·∏Ç√ó¬Ω·∏û¬µ∆¨
```
[Try it online!](https://tio.run/##y0rNyan8/1/r4Y6mw9MP7X24Y96hrcfW/D/cnvWocZ@OwsOda0EMKwXNyP//jXQUjHUUTHUUzAA "Jelly ‚Äì Try It Online")
Basically Dennis' method, but updated to use the modern version of Jelly. I initially had [9 bytes](https://tio.run/##y0rNyan8/1/r4Y6mhzuWPGqY4XFs08Md8451HVvzX@dwe9ajxn06Cse6QLSVgmbk//9GOgrGOgqmOgpmAA), but switching to the `√ó¬Ω` method saved 2 bytes.
## How it works
```
*·∏Ç√ó¬Ω·∏û¬µ∆¨ - Main link. Takes n on the left
     ¬µ  - Group the previous links into a monad f(n):
 ·∏Ç      -   Bit; n % 2
*       -   n ** (n % 2)
   ¬Ω    -   n ** (1 / 2)
  √ó     -   n ** (n % 2 + 1 / 2)
    ·∏û   -   Floor
      ∆¨ - Repeatedly apply f(n), yielding [n, f(n), f(f(n)), ..., 1]
```
[Answer]
# [Factor](https://factorcode.org/), 52 bytes
```
[ [ 3 dupn . odd? 3/2 .5 ? ^ 1 /i dup 1 > ] loop . ]
```
[Try it online!](https://tio.run/##JYrBCsIwEAXv/Yr3BSkavCjYo3jxUjyVCkuSajBuwro96M/HqrdhZiZymqWe@@PpsMU1cBBK8U0aMz9xD8Ih4UF6Q5Gg@ioSWX/CTDO7/7ZrGlsHDLDwc2EYZO872HYNs0GHC1Zo47ctsMeIlHNZrrE6Sql@AA "Factor ‚Äì Try It Online")
[Answer]
# [Lua](https://www.lua.org/), 49 bytes
```
b=...repeat a=b print(a)b=b^(.5+b%2)//1until a==b
```
[Try it online!](https://tio.run/##yylN/P8/yVZPT68otSA1sUQh0TZJoaAoM69EI1EzyTYpTkPPVDtJ1UhTX9@wNK8kMweowDbp////xgA "Lua ‚Äì Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 55 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 6.875 bytes
```
‚à∑.+e‚åä)‚Üî
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyI9IiwiIiwi4oi3Litl4oyKKeKGlCIsIiIsIjMiXQ==)
## Explained
```
‚à∑.+e‚åä)‚Üî¬≠‚Å°‚Äã‚Äé‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å¢‚Å¢‚Å™‚Äè‚Å†‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å¢‚Å£‚Å™‚Äè‚Äè‚Äã‚Å°‚Å†‚Å°‚Äå‚Å¢‚Äã‚Äé‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å°‚Å™‚Äè‚Å†‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å¢‚Å™‚Äè‚Å†‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å£‚Å™‚Äè‚Äè‚Äã‚Å°‚Å†‚Å°‚Äå‚Å£‚Äã‚Äé‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å§‚Å™‚Äè‚Äè‚Äã‚Å°‚Å†‚Å°‚Äå‚Å§‚Äã‚Äé‚Äé‚Å™‚Å°‚Å™‚Å†‚Å™‚Å¢‚Å°‚Å™‚Äè‚Äè‚Äã‚Å°‚Å†‚Å°‚Äå¬≠
     )‚Üî  # ‚Äé‚Å°Generate until fixed point, starting with the input:
‚à∑.+      # ‚Äé‚Å¢  Add the bit parity of the argument to 0.5 (0.5 if even, 1.5 if odd)
   e     # ‚Äé‚Å£  And raise the argument to that number
    ‚åä    # ‚Äé‚Å§  Floor it.
üíé
```
Created with the help of [Luminespire](https://vyxal.github.io/Luminespire).
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), 7.5 bytes (15 nibbles)
```
`.$^^$^3%$~-2
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWaxP0VOLiVOKMVVXqdI0gYlCppdFKxkqxUA4A)
```
`.              # iterate while unique
  $             # starting with input:
        %$~     #  result-so-far modulo-2
      ^3        #  3 to the power of that (so: 3 or 1)
    ^$          #  result-so-far to the power of that
   ^       -2   #  floor square-root
```
[Answer]
# TI BASIC, 43 bytes
I'm pulling a Thomas Kwa and answering this one on my mobile.
```
Input N
Repeat N=1
Disp N
remainder(N,2->B
If not(B:int(sqrt(N->N
If B:int(N^1.5->N
End
1
```
Replace `sqrt` with the actual symbol on your calculator. Displays a linefeed separated list of numbers, which is a reasonable format.
[Answer]
# JavaScript ES6, 76 bytes
Is a generator named `j`. To use, set `a = j(<your value>);`. To see the next value in the sequence, enter `a.next().value`.
```
function*j(N){for(yield N;N-1;)yield N=(N%2?Math.pow(N,3/2):Math.sqrt(N))|0}
```
Ungolfed:
```
function* juggler(N){
    yield N;
    while(N!=1){
        N = Math.floor(N % 2 ? Math.pow(N,3/2) : Math.sqrt(N));
        yield N;
    }
}
```
]