[Question]
  [
Write code that when given a positive number \$x\$ as input, outputs the largest positive divisor of \$x\$ less than or equal to the square root of \$x\$.
In other words find the largest \$n > 0\$ such that
\$\exists m\geq n:m\cdot n=x\$
(Exists \$m\$ greater than or equal to \$n\$ such that \$m\$ times \$n\$ is \$x\$)
---
For example if the input were \$12\$ the divisors are \$1\$, \$2\$, \$3\$, \$4\$, \$6\$, and \$12\$. \$1\$, \$2\$ and \$3\$ all multiply by larger numbers to get \$12\$, but \$3\$ is the largest so we return \$3\$.
---
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so answers will be scored in bytes with fewer bytes being considered a better score.
## Test Cases
```
(1,1)
(2,1)
(3,1)
(4,2)
(5,1)
(6,2)
(7,1)
(8,2)
(9,3)
(10,2)
(11,1)
(12,3)
(13,1)
(14,2)
(15,3)
(16,4)
(17,1)
(18,3)
(19,1)
(20,4)
(21,3)
(22,2)
(23,1)
(24,4)
(25,5)
(26,2)
(27,3)
(28,4)
(29,1)
(30,5)
(31,1)
(32,4)
(33,3)
(34,2)
(35,5)
(36,6)
(37,1)
(38,2)
(39,3)
(40,5)
(41,1)
(42,6)
(43,1)
(44,4)
(45,5)
(46,2)
(47,1)
(48,6)
(49,7)
(50,5)
```
[OEIS A033676](http://oeis.org/A033676)
  
[Answer]
# [Python3](https://www.python.org/), 49 47 bytes
```
def f(x):
 l=x**.5//1
 while x%l:l-=1
 return l
```
# Explanation
* `l=x**.5//1` → Assign `l` the largest integer less than equal to the square root of `x`
* `while x%l:l-=1` → While `l` does not evenly divide `x`, decrement `l`.
### Edits
* Mention Python3, not Python2
* Use `...//1` to save two bytes. (Decimals are okay! Thanks @Rod)
[Answer]
# [MATL](https://github.com/lmendo/MATL), 7 bytes
```
Z\tn2/)
```
[Try it online!](https://tio.run/##y00syfn/PyqmJM9IX/P/f0MLAA "MATL – Try It Online")
For this explanation, we will use '12' as a sample input. Explanation:
```
Z\      % Divisors.
        % Stack:
        %   [1 2 3 4 6 12]
  t     % Duplicate.
        % Stack:
        %   [1 2 3 4 6 12]
        %   [1 2 3 4 6 12]
   n    % Number of elements.
        % Stack:
        %   6
        %   [1 2 3 4 6 12]
    2/  % Divide by 2
        % Stack:
        %   3
        %   [1 2 3 4 6 12]
      ) % Index (grab the 3rd element)
        % 3
```
This works because of a lot of lucky coincidences. 
1. MATL uses 1 indexing
2. If we index with a non-integer (this will happen for any perfect square input), then `<n>)` will index \$\lceil n \rceil\$
[Answer]
# [C (gcc)](https://gcc.gnu.org/) `-lm`, 35 bytes
```
i;f(n){for(i=sqrt(n);n%i;i--);n=i;}
```
[Try it online!](https://tio.run/##HYvBCoMwEETv@YogBHYxOUihl61/4kUikQFN2@hN/PWmq3N6M8yLYY6xVkiizEd6F0K/fcuuTbKDIASFHnLWdUQmNoexGuTdQszNalnVOsHr8RS0Ld/zlU/RY6KG3OTdxENuPHwiMIs56y@mZZy3Gpb1Dw "C (gcc) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 5 bytes
```
Ñ2äнθ
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8ESjw0su7D234/9/QyMA "05AB1E – Try It Online")
or as a [Test suite](https://tio.run/##ASUA2v8wNWFiMWX/NTBMdnn/w5Eyw6TQvc64/3kiKMO/LMO/KSIs/zEy)
**Explanation**
```
Ñ        # push the list of divisors
 2ä      # split it into 2 parts
   н     # take the first haft
    θ    # take the last element of that
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~16~~ ~~14~~ 12 bytes
I'm glad I was able to write some answer in APL since I only just learned it. Many, many thanks to Adám for help with golfing. Golfing suggestions very much welcome. [Try it online!](https://tio.run/##SyzI0U2pTMzJT////1FPh371o97Nj3q6HvVu1Tq83aj2UceKR12L/qc9apvwqLfvUd9UT/9HXc2H1hs/apsI5AUHOQPJEA/P4P9pCkYGXAA "APL (Dyalog Unicode) – Try It Online")
To learn more about APL, take a look at [The APL Orchard](https://chat.stackexchange.com/rooms/52405/the-apl-orchard).
**EDIT:** -2 bytes to fixing a problem with my code. Thanks to H.PWiz for pointing out that problem. -2 bytes from shortening everything again.
```
⌈/{⍳⌊⍵*÷2}∨⊢
```
**Ungolfing**
```
⌈/{⍳⌊⍵*÷2}∨⊢
          ∨   GCD of the following...
           ⊢    The right argument, our input.
  {⍳⌊⍵*÷2}
     ⍵            Our input.
      *÷2         To the power of 1/2, i.e. square root.
    ⌊             Floor.
   ⍳              Indices up to floor(sqrt(input)).
                In total, range from 1 to floor(sqrt(input)).
⌈/            The maximum of the GCDs of our input with the above range.
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
→←½Ḋ
```
[Try it online!](https://tio.run/##yygtzv7//1HbpEdtEw7tfbij6////8amAA "Husk – Try It Online")
### Explanation
```
→←½Ḋ
   Ḋ      Divisors of (implicit) input.
  ½       Bisect.
→←        Take the last element of the first half.
```
[Answer]
# [R](https://www.r-project.org/), ~~45~~ 33 bytes
```
function(x,y=1:x^.5)max(y[!x%%y])
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP0@jQqfS1tCqIk7PVDM3sUKjMlqxQlW1Mlbzf3FiQUFOpYahlamBTprmfwA "R – Try It Online")
Original:
```
function(x,y=x/1:x^.5)max(which(y==floor(y)))
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP0@jQqfStkLf0KoiTs9UMzexQqM8IzM5Q6PS1jYtJz@/SKNSU1Pzf3FiQUFOpYahlamBTprmfwA "R – Try It Online")
[Answer]
# x86 32-bit (IA32) machine code: ~~18~~ 16 bytes
changelog: handle the `n=1` test case correctly, save 2 bytes, and return in EAX.
**Count up until `n/i <= i` (i.e. when we reach the sqrt), and use the first exact divisor after that.**
A 64-bit version of this is callable from C with the x86-64 System V calling convention, as  
`int squarish_root_countup(int edi)`.
`nasm -felf32 -l/dev/stdout squarish-root.asm`:
```
58                         DEF(squarish_root_countup)
59                             ; input: n in EDI
60                             ; output: EAX
61                             ; clobbers: eax,ecx,edx
62                         .start:
63 00000025 31C9               xor    ecx, ecx
64                         .loop:                    ; do{
65                         
66 00000027 41                 inc    ecx                ; ++i
67 00000028 89F8               mov    eax, edi
68 0000002A 99                 cdq
69 0000002B F7F9               idiv   ecx                ; edx=n%i    eax=n/i
70                         
71 0000002D 39C1               cmp    ecx, eax
72 0000002F 7CF6               jl     .loop          ; }while(i < n/i
73                                                   ;          || n%i != 0);  // checked below
74                             ; falls through for i >= sqrt(n)
75                             ; so quotient <= sqrt(n) if we get here
76                         
77                                                   ; test edx,edx / jnz  .loop
78 00000031 4A                 dec    edx            ; edx-1 is negative only if edx was zero to start with
79 00000032 7DF3               jge   .loop           ; }while(n%i >= 1);
80                             ; falls through for exact divisors
81                         
82                             ; return value = quotient in EAX
83                         
84 00000034 C3                 ret
           0x10 bytes = 16 bytes.
85 00000035 10             .size: db $ - .start
```
[Try it online!](https://tio.run/##5Vbfb9NIEH73XzGHGiVWSFsXrkBMKgUoKA9cTxDuToLKWtvjZDln191dJ24P/vbe7Np1kssF@sQLlqx4Zmdn58f3zYZpjYs4vx4Iphe3t50UMy4QXp2/7mWlSARboA93X0OY5TJmeavwPC8MIXgC8bVBDZlU8OhkEHPzEIJnTjx9bMVDgN6f3Mzho0p5P7gEmUEiS6XR9@xR@qpkiut5pKQ0Ea0Ik8qV8D2gJwQuitIMQdAHnL@aNFpZGqc@f/lXo0kouhiVHgKy6iEm9KaVd6gNU2bobHJk9scuwUesY3EnjEQ/sCtaQsaVNsANKma4FJBKSk3AEb1GwpyJNEcwcwQxCiBhGr3DXMpiCP/zhLT7H88dnWLSHL1rNBhwZ7OQS2dD0QNF53RJeuV@ecqX@/ZTmiPR4c3ekTji9ZnJomjTpQWn@zxzm1zMmz6@ruY8xx6HM7D7Ye8Trj@/fAF77C8jOPZJfXQEyRyTvzGFGHO5atqSsTzXVDEly9ncoYLD8xHoK2V61ONvHkWwMjY920lqwWdx04S@VdO02qnHIABObcMZNXGJIEV@DTxzpium4QaVtO102IAVYbMpDu7WZl0cm@zZCAI/3JsaViwxQL3iWirtNXZVMp@1jXUdDEGhKVWN6QbBpCG08hsiWhrDAQygxq6lGQSn2/x6ssEv6Ln8Apj89nIvo8rinnwa359PFYXQAiyp7scELvYzod//gUzIv8OE5z@CCWdrJtRGNIKuSmk4CrNBEwveFcIMDcxR4U/BmoYhS5aXCKN1VSxsx9@ljNfhGU8FRNHFh@nvH6bR64t3b8fTKCIE5NmjEy98MZm@J0J5d7ceXU4ObK2sSdYbMqsceFo5JjnekAmRlgVrf5Ut3Ya/gvwVrTx@9@aPwGr6T70O5nSTbK@QfT84pSWR8owSYjmfCRoELnPL8sjl6m9RMoTp5MJdWqJroFByyVOEg@6nMugClfrBQa9QXJgMup24C91PVfeA@w/A9YGpma691ASkitBF6aK5bPU3lUMPrdhr393pl94Ga93Sya9ualnqUbfpYt0aSMvgDiN1j7Xr6ftJvaNxE1uuUvn3u2n/KfzXEw3UHU/UGO@bjspiJ6IGZZtuWLXO1Y6noK6LnYTWwOKhHnIGjqunx02a@lpHWHHTDuYe9/1mmMP4xeT29l8 "Assembly (nasm, x64, Linux) – Try It Online") with an asm caller that uses the first byte of argv[1] as an integer directly, and uses the result as process exit status.
```
$ asm-link -m32 -Gd squarish-root.asm && 
for i in {0..2}{{0..9},{a..f}};do 
    printf "%d   " "0x$i"; ./squarish-root "$(printf '%b' '\x'$i)"; echo $?;
done
0   0  # bash: warning: command substitution: ignored null byte in input
1   1
2   1
3   1
4   2
5   1
6   2
7   1
8   2
9   3
10   0       # this is a testing glitch: bash ate the newline so we got an empty string.  Actual result is 2 for n=10
11   1
12   3
13   1
14   2
15   3
16   4
   ...
```
[Answer]
# Japt `-h`, ~~8~~ 6 bytes
```
â f§U¬
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=4iBmp1Ws&input=MjAKLWg=)
2 bytes saved thanks to [Oliver](https://codegolf.stackexchange.com/users/61613/oliver)
---
## Explanation
```
           :Implicit input of integer U
â          :Divisors of U
  f        :Filter
   §       :  Less than or equal to
    U¬     :  Square root of U
           :Implicitly get the last element in the array and output it
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
ọⱮ½TṪ
```
[Try it online!](https://tio.run/##ASoA1f9qZWxsef//4buN4rGuwr1U4bmq/8OH4oKs//9bMTAwMCwyNiwyNSw0OV0 "Jelly – Try It Online")
[Answer]
# JavaScript ES7, ~~33~~ 31 bytes
```
n=>(g=x=>n%x?g(x-1):x)(n**.5|0)
```
[Try it online](https://tio.run/##BcFLCoMwEADQq3RTmNE66MJNYVJ6jlIwaAzxMyNJKRF69/S9xX5tGmM4Po3o5MrMRdiA58xGrvnhITcd3jOCVBX1vxbLqJJ0c7SphxcRPWO0J/Qt0urOBPim3R4Q2MxQ1wGRFg0y3C4Dlj8)
[Answer]
# [Snowman](https://github.com/KeyboardFire/snowman-lang), 38 bytes
```
((}1vn2nD`#nPnF|:|NdE|;:,#NMo*|,;bW*))
```
[Try it online!](https://tio.run/##NYw9D4IwGIT3/oo3UlMgCELiwoeTuklIHFwFWkIH3xJodLD41xFIvOVyl7unKod2qhUXGbXrUkOasiWxybbH8IURnh4WFngxscn52SSxZ@VX5Rovqe6u46xX4pBG9SBBInxC3z/sR8IVgVldL1E3wLYRh@wIDKhc@0B1OhhQvZ8l/h12AjZfKl26QC19G4rNOhZ1q2YgiukH)
```
((
  }        activate variables b, e, and g
  1vn2nD`  e=1/2
  #        retrieve the input into b
  nP       set b=b^e, which is sqrt(input)
  nF       floor the square root
  |        move b into g so there's space for a while loop
  :        body of the loop
    |NdE|  decrement the value in g
  ;:       loop condition
    ,#     assign b=input, e=current value
    NMo    store the modulo in g
    *|     discard the input value and place the modulo in the condition slot
    ,      put the current value back into g
  ;bW      continue looping while the modulo is nonzero
  *        return the result
))
```
[Answer]
# [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 24
```
?dsnv1+[1-dlnr%0<m]dsmxp
```
[Try it online!](https://tio.run/##S0oszvifll@kUJJaXJKcWJyqkJmnUG2gp2dqUKtgZmluaa2Qks9VUJSZV5KmoKSaoqBrp6CkoAJTzZWanJGP4CrUKKQkK@imqv@3TynOKzPUjjbUTcnJK1I1sMmNTSnOrSj4r86Vkp@X@h8A "Bash – Try It Online")
### Explanation:
```
?                         # read input
 d                        # duplicate
  sn                      # store copy 1 in register n
    v                     # take the square root of copy 2
     1+                   # add 1
       [          ]       # define macro to:
        1-                #   subtract 1
          d               #   duplicate
           ln             #   load from register n
             r            #   reverse top 2 stack members
              %           #   calculate modulo
               0<m        #   if not 0, recursively call macro m again
                   d      # duplicate macro
                    sm    # store copy 1 in register m
                      x   # execute copy 2
                       p  # print final value
```
[Answer]
# J, 24 19 bytes
*-5 bytes thanks to Sherlock's GCD idea*
```
([:>./+.)1+i.@<.@%:
```
[Try it online!](https://tio.run/##HU/LCsJADLz3K4IgtT623SR9olIQPHnyWsWDKOrF/z@tM7KEbDIzmeSTZiF/ym6QXNZSyYDYBDmcT8e0mIZ9KFehiKt3GLdhnA@pyLLH/fWVZSk3lcVznHbXorxIxFOEIRy/GrlBbpE75J5IRQqZUVmSG0mONcsGwkh@7Fj2nFhxGKeqgqdUqLNXw0FpoC3Rjj0qrAJg9DBFzwyo0cOosAZLGT2MSxm3ciqcCleg/r@AHk6F08Op8I5oj4tqKLKYpR8 "J – Try It Online")
# original answer
```
([:{:]#~0=]|[)1+i.@<.@%:
```
[Try it online!](https://tio.run/##HU9BasNADLz7FSKhOE4ae1eS7fUSg6HQU065uqaHUtP20gek9OvuTFmEVpoZjfS17epylTFLKY8SJCPOtTzdrs/bYc73vOx/w7j8zFU8fdbTpZ4e8lYVxfvbx7ccG3lVOazTPC5V8yIRTxGGcPxa5A65R07IA5FACplRWZIbSY4tyw7CSH5MLAdODBzGqargKRXq7LVwUBpoTzSxR4UFAEYPU/TMgBo9jArrsJTRw7iUcSunwqlwBer/F9DDqXB6OBWeiA64qIWiiMX2Bw "J – Try It Online")
## parsed
```
┌───────────────────────────────┬──────────────────────┐
│┌──┬──┬───────────────────────┐│┌─┬─┬────────────────┐│
││[:│{:│┌─┬─────┬─────────────┐│││1│+│┌─────────┬─┬──┐││
││  │  ││]│┌─┬─┐│┌─┬─┬───────┐││││ │ ││┌──┬─┬──┐│@│%:│││
││  │  ││ ││#│~│││0│=│┌─┬─┬─┐│││││ │ │││i.│@│<.││ │  │││
││  │  ││ │└─┴─┘││ │ ││]│|│[││││││ │ ││└──┴─┴──┘│ │  │││
││  │  ││ │     ││ │ │└─┴─┴─┘│││││ │ │└─────────┴─┴──┘││
││  │  ││ │     │└─┴─┴───────┘│││└─┴─┴────────────────┘│
││  │  │└─┴─────┴─────────────┘││                      │
│└──┴──┴───────────────────────┘│                      │
└───────────────────────────────┴──────────────────────┘
```
## explanation
* `1 + i.@<.@%:` gives the range `1 .. floor(sqrt)`.
* the entire verb `(A) B` forms a hook, with the above range passed as the right arg `]` to A and the original number passed as its left arg `[`. Thus...
* `] | [` gives the remainer of each item in the range divided into the original arg.
* and `0 = ] | [` gives the divisors with no remainder.
* `] #~ ...` then filters the range, leaving only those.
* and `{:` gives the last item in the list, ie, the largest one.
[Answer]
# [Python 2](https://docs.python.org/2/), 41 bytes
```
n=k=input()
while(k*k>n)+n%k:k-=1
print k
```
[Try it online!](https://tio.run/##K6gsycjPM/pfnpGZk6pgaJVakZqspKT0P8822zYzr6C0REOTCyynka2VbZenqZ2nmm2VrWtryFVQlJlXopD9H6TaxJzLxILLxJLL1AAA "Python 2 – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `G`, 5 bytes
```
K'?√≤
```
[Try it online](https://vyxal.pythonanywhere.com/#WyJHIiwiIiwiSyc/4oia4omkIiwiIiwiMTAiXQ==), or see [a flagless MATL port](https://vyxal.pythonanywhere.com/#WyIiLCIiLCJL4oKFwr1pLyIsIiIsIjI4Il0=).
Explanation:
```
K      # Factors
 '     # Filter by:
   √   #   Square root of
  ?    #   The input
    ≤  #   Is less than or equal to the input
       # Get the greatest item with the G flag
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
½ḍƇµṪ
```
[Try it online!](https://tio.run/##ARwA4/9qZWxsef//wr3huI3Gh8K14bmq/zUww4figqz/ "Jelly – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 36 bytes
```
f x=[z|y<-[1..],z<-[1..y],y*z==x]!!0
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P02hwja6qqbSRjfaUE8vVqcKwqiM1anUqrK1rYhVVDT4n5uYmWdbUJSZV6KSpmBo8B8A "Haskell – Try It Online")
Well this is my answer to this challenge.
This uses a particular list comprehension to find the answer.
In our list comprehension we pick \$y\$ from the infinite list `[1..]` that is the positive integers, and we pick \$z\$ from the list `[1..y]`. This means that \$(y,z)\$ is all the ordered pairs such that \$y \geq z\$.
We then select only those pairs such that \$y\cdot z=x\$, meaning that we make the list of all pairs of numbers that multiply to \$x\$. Now since our comprehension is based first on \$y\$ and then \$z\$ this means that our pairs are in ascending order of \$y\$, or more usefully in descending order of \$z\$.
So to get the largest \$z\$ we take the \$z\$ belonging to the first element. This is our result.
[Answer]
## QBasic (4.5), 52 bytes
```
INPUT x
FOR i=1TO sqr(x)
if x/i=x\i then m=i
next
?m
```
[Answer]
# [Forth (gforth)](http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/), 53 bytes
The shortest way seems to be using the floating point stack and `fsqrt`, the shortest I could get without it was 62 bytes using `/mod` and checking if the quotient was greater than the divisor.
```
: f dup s>f fsqrt f>s 1+ begin 1- 2dup mod 0= until ;
```
[Try it online!](https://tio.run/##HYxBDoMgAATvfcXEawMpJr1o6l8siCWlQgETf0@xpz3MzNqQykus9pxaByxmj@TJYvM3FeyUUVeey@o2lKA/8ScYbg/2rTjP2Kr4r3pkQnYgJrr2JNGJ8TJwcFcoTMA1VftlTrnM@o0PITbjqD8 "Forth (gforth) – Try It Online")
### Explanation
1. Calculate the square root
2. Starting at the square root, decrement by 1 until we find a factor of the original number
### Code Explanation
```
: f                \ Start a word definition
dup                \ duplicate the input
s>f fsqrt          \ move the number to the float stack and get the square root
f>s                \ truncate result and move to integer stack
1+                 \ add 1 to the square root
begin              \ start indefinite loop
  1- 2dup          \ decrement divisor and duplicate input and divisor
  mod              \ calculate n % divisor
0= until           \ if result equals 0 (no remainder) end the loop
;                  \ end the word definition
```
[Answer]
# F#, 55 49 bytes
```
let f x=Seq.findBack(fun i->x%i=0.0){1.0..x**0.5}
```
[Try it online!](https://tio.run/##LY7NCsIwEITveYqlUGiKDfHQm81B8C54FA@hJrLYphrbUtE@e8yPp11mZ78Z/arawSrnOjWChqU5qSfTaK572d4LPRnASiw5Npxx@tkyzthSlpzVa/x4WDSjsjDLblLQEI9I61eAv5Awo0cbyIocN5AjzaDwSjJSQs67gxnt@zh4UVxIwPYSDUh7mwMypda@wBp5oSGG0H84Ae5@)
`Seq.findBack`: Returns the last element for which the given function returns `True`. The function in this case checks to see if a number is a factor of the value.
[Answer]
# [Brain-Flak](https://github.com/Flakheads/BrainHack), 144 bytes
```
{({}{}<<>({}<>)<>([({})()]<>({}(<>)())){(<{}({}[()]{}<({}())>)>)}{}((({}<>)<>(({})))[({}[{}])])>[({<({}[()])><>({})<>}{}<><{}>)])}{}{}<>{}({}<>)
```
[Try it online!](https://tio.run/##PY2xDoBACEN/h44mNxJ@5HKDumhMHFwJ347lYgxDodDH9qznfaz7leni4aFqVDVQOzsIxrSEngBwUQ4enQse1gYwFsMif7aiQBG6x8CAsdcvB5tI3tVHI9Boxvxvk05IZi6tvQ "Brain-Flak (BrainHack) – Try It Online")
I'm not really sure this answer is very good. I feel like there may be a nice way to solve this task however I'm just not clever enough.
## Explanation
I tried to do an exploded view of the answer but there are so many moving parts it was not very enlightening, so here is an explanation of what the code does.
The first important bit is this
```
({}<>)<>([({})()]<>({}(<>)())){(<{}({}[()]{}<({}())>)>)}{}
```
This takes the two numbers on top of the stack and if they are unequal increments the second one, if they are equal it increments the first one and replaces the second one with zero. If we repeat this code a bunch we will get all the pairs \$(x,y)\$ such that \$x \geq y\$.
The next part is multiplication, taken with modification from [the wiki](https://github.com/DJMcMayhem/Brain-Flak/wiki/Basic-Arithmetic-Operations). This multiplication is special because it preserves the existing values without destroying them. It goes like:
```
((({}<>)<>(({})))[({}[{}])])({<({}[()])><>({})<>}{}<><{}>)
```
So we are multiplying all these ordered pairs. For each result we check if it is equal to the input. If so we terminate and return the smaller item in the pair.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
ÆDŒHḢṪ
```
[Try it online!](https://tio.run/##y0rNyan8//9wm8vRSR4Pdyx6uHPV////TQ0A "Jelly – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 26 bytes
```
$\=0|sqrt;$\--while$_%$\}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lxtagpriwqMRaJUZXtzwjMydVJV5VJaa2@v9/I5N/@QUlmfl5xf91CwA "Perl 5 – Try It Online")
[Answer]
# Rust, 71 70 bytes
```
fn f(x:u64)->u64{let mut l=(x as f64).sqrt()as u64;while x%l>0{l-=1}l}
```
## Pre-uglified version
```
fn f(x: u64) -> u64 {                    // function takes u64, gives u64
  let mut l = (x as f64).sqrt() as u64;  // l takes integer'ed root value
  while x % l > 0 {                      // loop while l leaves remainder
    l -= 1                               // decrement
  }
  l                                      // return the found value
}
```
### Edits
* Save a byte with `> 0` over `!= 0`. (Thanks to @CatWizard)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 8 bytes
```
â w æ§Uq
```
[Try it online!](https://tio.run/##y0osKPn///AihXKFw8sOLQ8t/P/f2AwA "Japt – Try It Online")
[Answer]
# [Triangularity](https://github.com/Mr-Xcoder/Triangularity), 49 bytes
```
....)....
...@_)...
..IEdF)..
.2)1/)IE.
^>{m.....
```
[Try it online!](https://tio.run/##KynKTMxLL81JLMosqfz/Xw8INEEEFxA7xGtCWJ6uKW6aIJaRpqG@pqerHlecXXUuSJne//@GRgA "Triangularity – Try It Online")
[Answer]
# [Pyret](http://www.pyret.org), 93 bytes
```
{(z):rec f={(i,x):if num-modulo(i, x) == 0:x else:f(i,x - 1)end}
f(z,num-floor(num-sqrt(z)))}
```
You can try this online by copying it into [the online Pyret editor](https://code.pyret.org/editor)!
The above evaluates to an anonymous function. When it is applied to an integer, it returns a result according to the specification.
[Answer]
# [Actually](https://github.com/Mego/Seriously), 7 bytes
Based on [my APL answer here](https://codegolf.stackexchange.com/a/167182/47581). Golfing suggestions welcome! [Try it online!](https://tio.run/##S0wuKU3Myan8/9/6Uccsn6BHMxvSff//NzIAAA "Actually – Try It Online")
```
;√LR♀gM
```
**Ungolfing**
```
;√LR♀gM  Implicit input n
;        Duplicate n
 √       sqrt(n)
  L      floor(sqrt(n))
   R     1..floor(sqrt(n))
    ♀g   gcd(n, foreach(1..floor(sqrt(n)))
      M  The maximum of the GCDs.
         Return this maximum.
```
[Answer]
A port of [this Mathematica answer](https://codegolf.stackexchange.com/a/18355).
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
½ðḞ³÷Ċ³÷µÐL
```
[Try it online!](https://tio.run/##y0rNyan8///Q3sMbHu6Yd2jz4e1HukDkoa2HJ/j8///fyAwA "Jelly – Try It Online")
This (11 bytes) also works, and don't depend on `³`:
```
½Ḟ÷@Ċ÷@ʋƬµṪ
```
Unfortunately `½Ḟ÷@Ċ÷@ʋÐL` (10 bytes) doesn't work. And apparently `Ƭ` and `ÐĿ` is not exactly the same (when the link is dyadic)
---
Method: (let \$n\$ be the input)
* Start with an upper bound \$i = \sqrt n\$ of the answer \$a\$.
* At each step:
	+ If \$i\$ is not an integer, then the upper bound can be made \$\lfloor i\rfloor\$ (because the result must be an integer)
	+ If \$n\over i\$ is not an integer, then \$a \le i
	\Rightarrow \frac n a \ge \frac n i
	\Rightarrow \frac n a \ge \lceil \frac n i \rceil
	\Rightarrow a \le n \div \lceil \frac n i \rceil
	\$.
* So we repeatedly replace \$i\$ with \$n \div \lceil \frac n {\lfloor i\rfloor} \rceil\$ until it's fixed.
]