[Question]
  [
If we take a positive integer \$n\$ and write out its factors. Someone can determine \$n\$ just from this list alone. In fact it is trivial to do this since the number is its own largest factor.
However if we take \$n\$ and write only the first half of its factors (factors that are smaller than or equal to \$\sqrt{n}\$), it becomes a lot more difficult to tell the original number from the list alone. In fact, it frequently becomes impossible to tell at all. For example both \$28\$ and \$16\$ give
\$
\begin{array}{ccc}
1 & 2 & 4
\end{array}
\$
as the first half of their factors (along with an infinite number of other solutions). So if you show this list to someone they cannot know for sure what your original number was.
But some special cases do have a single unique solution. For example
\$
\begin{array}{ccc}
1 & 2 & 3 & 5
\end{array}
\$
is unique to \$30\$. No other number has these as its smaller factors.
---
The goal of this challenge is to write a program or function which takes as input an integer \$n\$ and determines if the first half of its factors are unique or not.
Your output should be one of two consistent values, one corresponding to inputs that are unique and one to inputs that are not.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so answers will be scored in bytes with fewer bytes being the goal.
---
## Test cases
The first 120 truthy values are:
```
24 30 40 50 56 60 70 80 84 90 98 100 105 108 112 120 126 132 135 140 150 154 162 165 168 176 180 182 189 192 195 196 198 208 210 220 231 234 240 242 252 260 264 270 273 280 286 288 294 297 300 306 308 312 315 320 324 330 336 338 340 351 352 357 360 363 364 374 378 380 384 385 390 396 399 408 416 418 420 429 432 440 442 448 450 455 456 459 462 468 476 480 484 494 495 504 507 510 513 520 528 532 540 544 546 552 560 561 570 572 576 578 585 588 594 595 598 600 608 612
```
If you want more test cases I've written a reasonably fast generator (generates the first 500 in under 3 seconds on TIO).
[Try it online!](https://tio.run/##jVRNj9owEL3nV7zDHpJdkkKkXtAGVVVVqYd2pXKphJaVWRywYjtfjggSv710EkLWAdruIbE9eW8@3oyzZWXCpTwKlaWFQV4xKWLB1/jCDAvm3ICVoOXoBofAw3TqAC6@acM3BZNgdPToAaIZGPzu9TlNpaNAFGhE9F2la9opRBHGjuOIeU7BOmdPxbr1M8KPSt3y2MEbP5uU@MBuywvegshgULdb4IDw3mAW9YaoWwHTQ1JD5J0o@RWGfLnmYeLBrX1y5E88SnXLZPyTCb1Kd@@ofkHL84Bzqn@BxGmCJ3j0W8ICEwQBTpVp4jT1JyfFaP9MkSst8oqX/456CniGdhJRvwKuMrNHOBBrlVZ6jRpx2VethBaKZL/rVXBrLBFi6lk2IBbS8ALuDLVnmZtCsmWIe@TLcGA/IKNaKdTAOkJ@05rhQ4R8YGwk6LpSUs7nhCU3PczS@dcnV7Jiw0szV0zKr@zVpAWmePGsBg8Y/ZAA3Ubo3iJii9TIqbhaUf12RLwVQSOlLUKbMun4gMmbWFyWfOg3LS6UtLPbN3fFDneh7v48SbaDJuS1DBewUQtrevZfKE3oeWb@mgra4b11ulbFbaQUuuQ09EMpvZt6Weyamvk@Dy38qOjD6dfDsu8vyAqhDe5gWMLxcTxGd2WOv19jyTbl0X8K/wA "Haskell – Try It Online")
For falsy values I recommend you check everything under 50 not on this list, but in particular 12.
  
[Answer]
# [J](http://jsoftware.com/), 40 bytes
```
1=1#.]-:&(([#~0=|)~i.#~%:>:i.)"+[:i.1+*:
```
[Try it online!](https://tio.run/##RY3BCsIwEETv@Yq1RdMYu2zS2tZAvAiePPVaiohYWhEErQdB@usxVkSYYdi3DHN2q4lJcqiBYO@ttWYB8gasAQ4LT4x3jLApd1unrAqxjs0siqpwIPsSQ4fhMDVr06EIZOVDyblxgvW3R98@LeoUEoKUYOmVQUaQExTEmsPl7t@Rkh0WJD4T3wpjp2N7hSaQPzDenP/52HVv "J – Try It Online")
Here are all test cases, with squaring replaced by `5*x` so it finishes on TIO:
[Try it online!](https://tio.run/##RZJNaxsxEIbv@yumNo3tuFk0X9rVgnsp9NRTriGEUGriUig06aFQ/NfdRymlsC@S3hk9zIz266W9WXySeynygMxsWI2boxwW2cg7nAXdjPLh9tPHix50Pd7fLFfb7d36XA6/d@fTuD6/Xd4vp3G32t@x6D6vri@74eXHz5enX4fRQrxIFEm@KrXIVGTmC2lF2ixaCkrEXk3UOFsVdfaOz13NrhCteBWvkjuRA0hnvLmJNtZGrOHDNXimvSXkikIMloWJJaIUq3jUY5OLwbK5Iu41/DZReUEVzeLU5pri8Lx3RVvuxJwYXE9F5CT3YHt1RN7URQ58p2ufYdC6U6e3xmhmCa2IFXYYHr0HzIi@4tN/ZCLykjhzCGYQzCDgBtxoXcmcA02S9J7qkjDTZkmY2d8hiEeVpNas/VFUkhnkxBleUmtSYzKHhJmdyTwrs6jUWtWG4@O3Z952q/vTyHnX/5C/Dz4MXz4/fZfjav/PeD1vNv/918uXPw "J – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 31 bytes
```
Ｎθ≔ＥＸ⊕θ²Φ⊕ι∧λ¬∨›Ｘλ²ι﹪ιλη⁼¹№η§ηθ
```
[Try it online!](https://tio.run/##XY0xDsIwDEV3TpHRlcJAxdapQoAytPQKoYloJNdp0wS4fXDUDUuW7O/3v8dJh9FrzFnRkmKf5qcNsFbNod029yLo9AKD/7CoaAx2thStYUCKmvvmMP6dHMstGUApeh/hEeAerC7UHoO7s2CdNwk9OCmwKiXFxI@H4CjCdU0aNzhJcfGJ94lToyJjv2VcC97kXJ/z8Y0/ "Charcoal – Try It Online") Link is to verbose version of code. Inefficiently outputs a Charcoal boolean, i.e. `-` for unique, nothing if not. Explanation:
```
Ｎθ
```
Input `n`.
```
≔ＥＸ⊕θ²Φ⊕ι∧λ¬∨›Ｘλ²ι﹪ιλη
```
For all integers up to `(n+1)²`, list those factors that do not exceed its square root.
```
⁼¹№η§ηθ
```
See whether the `n`th list is unique.
Edit: Switching from `(2n)²` to `(n+1)²` made the code an order of magnitude faster without generating false positives. At a cost of 3 bytes, `2+⁴√n⁵` would be even faster; this works because the worst case scenario is of the form `p₁²p₂` where `p₁<p₂<p₁²`; the next integer with the same half rainbow is `p₁p₂²`, and since `p₂<p₁²` we have `p₂³<p₁⁶` and therefore `(p₁p₂²)⁴<(p₁²p₂)⁵`.
[Answer]
# [Haskell](https://www.haskell.org/), 68 bytes
```
f n=[x|x<-[1..n],x*x<=n,n`mod`x<1]
g n=[1|x<-[2..n*n],f n==f x]==[1]
```
[Try it online!](https://tio.run/##RYzBCoJAFEX3fcVdtBKTNzaZwry/aCcDCqlJ@gwreIv@fRrbBGd3z7m39nnvpimEHsK1ftQdapNl4lNN1LGk0szLtVFn/G7YFPNT8qgkUdoq7qGe4@LD3I4CxmMd5bX/vxkinw5Q5sv67nzILY4ESzhFChSEM6GMWFSEqkQM8AU "Haskell – Try It Online")
* thanks to @ovs for fixing an error at no cost!
 [all test cases](https://tio.run/##7ZFNahxBDEb3OUUtsoiNYkp/1V0wfQvvhgYPZOwY253gONAL3338KpvcIQT6o6qlTw9J9f306@n8/Hy53JdtOe7v@@HrUW9utlX26/2wbLLdvfz4drcfdP30MCz6x2JYrnOVUbXcl31dyKyXl9PjVpby8/Vxe/tcvrydns5Frf7lrvJQ9mW5ff19XstVWZZytBCvElWSr0mrMlWZ@UJ6lT6L1ooScVcTgKiJOncnTq3mUIg2Yo1YwzvhAaQzsbmLds5OrhOHa/BMqxg8c0UhBsvCxBLRijVi9GOTi8GyuSHqOvE@0XlFDc3i9Oaa4vB8TMVY7uScHFxPRXiSOtjeHOGbhvDAd6b2GQajO31676xmltCGOGGHEWP2gBkxTuLMH5kIX5JnD8EOgh0E3IAbfSjZc6BJktlTXRJm2iwJM8c7BPlokvSabTyKSrKDnPiHl/Sa9JjsIWHmYLLPxi4avTa19fL/Vf@9V/0A "Haskell – Try It Online")  with 5n instead of n squared to finish on Tio ( @Jonah trick )
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 80 bytes
```
(l=#;Tr[1^(S=Select)[Range[l^2+1],d@#==d@l&]]<2)&
d@n_:=S[Divisors@n,#<=Sqrt@n&]
```
[Try it online!](https://tio.run/##JcxBCsMgEADAe19RECShHmKObRb2kAeU2ptsikSxgtlSI/2@PWQeMJur77C5mlbXIrQug7g9i9VLZ8CEHNba24fjGGxexosm5VEAeMySaBp7efLIrysYO6df2j9lR1ZiAvMtFVlSu5fE9YxHdUyoh0FFan8 "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), 85 bytes
Based on [Noodle9's answer](https://codegolf.stackexchange.com/a/220919/64121).
The `1<<n` is only necessary for `n=1`, otherwise `n*n` would be shorter and a lot more efficient.
```
lambda n:2>(w:=[[a for a in range(x)if x>=a*a>1>x%a]for x in range(1<<n)]).count(w[n])
```
[Try it online!](https://tio.run/##RcqxDoMgEADQvV9xSxOugwl2MUb4EcpwraIk9iCERvr11C66veHFb14C37uYqlOPutL7ORJw32qx9coYAhcSEHiGRDxPoqB3ULSiG2mpy5XsP5QzyGFgtNi8woez2AxbrDH53U5IxMvhFrH@AA "Python 3.8 (pre-release) – Try It Online") or [Try it with `n*n`!](https://tio.run/##Rcy9CsIwFMXx3ac4i5AUEVoHJZC8SMxw/Yhe0JsQKo1PH1uXbmf4nX/@js8kh1MuLdpze9H7ciOIGZyajPWeEFMBgQWF5HFXVXNEdZY6cr2rWwoLqCuQTnTQ@2v6yKgmL0G3RfAqhh2OvTYbYE5Fxf8J5MLzg3X7AQ)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 80 bytes
```
n=>(q=t=>t&&q(t-1)+(g(t)==g(n)))(n*n+9)<2
g=n=>(h=i=>i*i>n||h(~-i)+[n%i?'':i])()
```
[Try it online!](https://tio.run/##FcrBDoIwDADQu//haGlmgjfFzvO@wXggyEYN6QQWT8Rfn3p8yXt2727tF3llq@kxlMBF2cHMmV02ZoZsGySIkJE5giIiaK10wstxF/l/RxZ2UovTbRvhYwXppnu5VtVZ7ghYQlrAc9O2RB4DeDSmT7qmaThMKf5cvg "JavaScript (Node.js) – Try It Online")
Can replace `n*n+9` to `2**n` in theory but not practical. `i` in `h` is negative so concatting lead to something like `true-3-2-1` for 12
[Answer]
# [Python 3](https://docs.python.org/3/), ~~103~~ 97 bytes
Saved 6 bytes ~~stealing~~ "borrowing" good golf ideas from [ovs](https://codegolf.stackexchange.com/users/64121/ovs)'s [answer](https://codegolf.stackexchange.com/a/220923/9481)!!!
```
lambda n,d=lambda x:[a for a in range(x)if x>=a*a>1>x%a]:all(d(n)!=d(a)for a in range(n*n)if a-n)
```
[Try it online!](https://tio.run/##XZLditswEIXv8xTqRYm9eCH6GdkKOC@yuxdqYndDU21IUkgJefZ0PrGlUIOOJc2ZOZojHX9f3j@Kf8zj6@OQf37bZVO63fg5va5fspk/TiabfTGnXL5PzbXdz@a6GfNT3tjN9Wt@W@fDodk1pf0y7prc/scvT4WM/Fzax3Q9TtvLtBsbFzrjV50JOoQROxP13@sYGBpP@k9DZ@xqBQjA0joFx57TLOtZeqIUs1JB020kEAlE0nrI1LYDgSEpJGYJSiKKmkPDWeU5NJy3gNZzlHdBM5wAHNdFAhza9V6B8m6IAFUS0dTT6gqIgAY8LXiruh4NX93ADu@heCioebEAZKEKkj56gIy@AmR0PZ75gaI45@nIp4THSgk2AsyQDI4A1gWEQqgzovgXRAAyBB5OBkwMmBhQC6iFVEG4wwDoIQXrxOohBSFxmiYISb3rAC9oFaEtifXutUvBROnZQ0NoS2hGcFIQkirEHUXsjLQVrWsX2/dp@2M6jc3y9Zfrw3bZmTqzftkueI7l33O0nV3Zdr0w@p3NaGZ9t3Ux6aLy/j7Suns87culmZe3cjfPG3M7383tU@5lGsfz233ZPv4A "Python 3 – Try It Online")
[Answer]
# Excel, 127 bytes
```
=LET(L,2+A1^1.3,x,SEQUENCE(L),y,SEQUENCE(L^0.5),u,TRANSPOSE(y),z,MMULT((MOD(x,u)=0)*(u<=SQRT(x)),2^y),SUM((INDEX(z,A1)=z)*1)=1)
```
modified Neil's upper bound to use n^1.3 instead of 1.25 to save a byte. n^2 would use too much memory with this solution.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 13 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
²‘½ḍƇ$€ċⱮ`⁸ịỊ
```
A monadic Link accepting a positive integer, \$n\$, that yields `1` if \$n\$ is a unique half rainbow or `0` if not.
**[Try it online!](https://tio.run/##ASsA1P9qZWxsef//wrLigJjCveG4jcaHJOKCrMSL4rGuYOKBuOG7i@G7iv///zU2 "Jelly – Try It Online")** Or see [those up to 60](https://tio.run/##ATEAzv9qZWxsef//wrLigJjCveG4jcaHJOKCrMSL4rGuYOKBuOG7i@G7iv/Dh@KCrFT//zYw "Jelly – Try It Online")
### How?
```
²‘½ḍƇ$€ċⱮ`⁸ịỊ - Link: integer, n
²             - square (n)
 ‘            - increment
     $€       - for each i in [1..n²+1]:
  ½           -   square root (i)
    Ƈ         -   filter [1..⌊√i⌋] keeping those which:
   ḍ          -     divide (i)
        Ɱ`    - map across itself with:
       ċ      -   count occurrences
          ⁸ị  - get entry at index n
            Ị - is insignificant (effectively = 1?)
```
[Answer]
# [Scala](https://www.scala-lang.org/), 97 bytes
Golfed version. [Try it online!](https://tio.run/##PY6xCsIwEIb3PsUtlqSDtI7FCI4OTuIkDrEmoRKvkl4lUvrsMWnRWw5@vu/u7xtpZehuD9UQHGWLMIa70qAZ1gckLlgF1AHytW4tKce82PnCbwXmOa68ECXPEm9@/Mg2s1BEpekGpGTEa1wIzTyPq5oCQHKe8R2TzvQ17J2Tn8uJXIvmyms4Y0sgYMwgzltacKofbIqWPlVZ/hsZPlOv6JJFtpApm7IpfAE)
```
def f(n:Int)=(1 to n).filter(x=>x*x<=n&&n%x==0)
def g(n:Int)={(2 to n*n).count(x=>f(n)==f(x))==1}
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `MAB`, ~~17~~ 13 bytes
```
²›ƛ₌K√ɾ↔;~iOṅ
```
-4 thanks to @lyxal!  
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyJNQUIiLCIiLCLCsuKAusab4oKMS+KImsm+4oaUO35pT+G5hSIsIiIsIjIzXG4yNFxuMjdcbjMwIl0=)
[Answer]
# [R](https://www.r-project.org/), ~~104 88 83 78~~ 74 bytes
```
m=scan();n=1:m^.5;for(i in 2:m^2)F=F+all(n[!m%%n]==(a<-1:i^.5)[!i%%a]);F<2
```
[Try it online!](https://tio.run/##K/r/P9e2ODkxT0PTOs/W0Co3Ts/UOi2/SCNTITNPwQjIN9J0s3XTTszJ0ciLVsxVVc2LtbXVSLTRNbTKBKrVjFbMVFVNjNW0drMx@m9i8B8A "R – Try It Online")
following [Neil's solution](https://codegolf.stackexchange.com/a/220937/85958) checking for all integers till n².
]