[Question]
  [
# Challenge
Given a positive integer, return the product of its divisors, including itself.
This is [sequence A007955 in the OEIS](http://oeis.org/A007955).
# Test Cases
```
1: 1
2: 2
3: 3
4: 8
5: 5
6: 36
7: 7
8: 64
9: 27
10: 100
12: 1728
14: 196
24: 331776
25: 125
28: 21952
30: 810000
```
# Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in each language wins!
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
√ëP
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8MSA//@NTAA "05AB1E ‚Äì Try It Online")
**Explanation**
```
√ë    # divisors
 P   # product
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), 3 bytes
```
√¢ √ó
```
[Try it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=4iDX&input=MjQ=)
## Explanation
```
√¢ √ó  // implicit integer input
√¢    // get integer divisors
  √ó  // get product of array
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~42~~ 41 bytes
Saved 1 byte thanks to Leaky Nun!
```
f=lambda i,k=1:k>i or k**(i%k<1)*f(i,k+1)
```
[Try it online!](https://tio.run/##DYxBCoMwEADvfcVeCrtxD93YQhH1I6WHiE27RKPEXHx9GpjTDMx@5t8W21L8sLh1mh0oh0G6MCpsCYIxqNfQCxmPtTRCxVevoBEWPTImF78fFBYhal5iWe5sKw@2T25v7@4CsCeNGeuAqPwB "Python 3 ‚Äì Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
√ÜDP
```
[Try it online!](https://tio.run/##y0rNyan8//9wm0vA////jUwA "Jelly ‚Äì Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 3 bytes
```
Z\p
```
[Try it online!](https://tio.run/##y00syfn/Pyqm4P9/MwA "MATL ‚Äì Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 35 34 bytes
*-1 thanks to ovs*
```
f n=product[x|x<-[2..n],n`mod`x<1]
```
[Try it online!](https://tio.run/##DcLRCoIwFAbgVzmXCr/ijloG2hv4BGvkyCTJzWEK56J3X318L/t5P5clxol8F7Z1PB67lq@0meY89wZ@cOs4SKtMdHb21JGzob9TchPKrhS22e@UCGgiSVPSCowSFWqccEaDC1QBxVAV@L8GNygLE38 "Haskell ‚Äì Try It Online")
[Answer]
## [Alice](https://github.com/m-ender/alice), 12 bytes
```
/o
\i@/Bdt&*
```
[Try it online!](https://tio.run/##S8zJTE79/18/nysm00HfKaVETev/fyMTAA "Alice ‚Äì Try It Online")
### Explanation
This is just the regular framework for decimal I/O:
```
/o
\i@/...
```
Then the program is:
```
B    Get all divisors of the input.
dt   Get the stack depth minus 1.
&*   Multiply the top two stack elements that many times, folding multiplication
     over the stack.
```
[Answer]
# [Factor](https://factorcode.org/), 43 bytes
```
[ dup [1,b] [ dupd divisor? ] count 2 / ^ ]
```
[Try it online!](https://tio.run/##NY09C8IwGIT3/opzl2pi6@fgKC4u4lQqxDRqsE1i8kYQ8bfXUhWO4zk4eM5CkvXtYb/dbZa4KW9UjUbQta/UC3NR4cvnaCRpa36z1qcGziuip/PaEIK6R2Vkd18l290SQXpB8pokA5AKBG1cpJC8wMAxQYYcU8wwxwJsDMbBMvAuOfgckzHebYEqOhRseCrRc4VKP3Swfo0S0sbOyjHCEWXbCPcX2Ui9KYWslfDtBw "Factor ‚Äì Try It Online")
Uses the formula `n^((number of divisors of n)/2)`.
Usually `mod 0 =` (7 bytes) is shorter than `divisor?` (8 bytes), but the latter is used here to auto-load `math.functions` to disambiguate `^` (which happens to appear in a regex lib). Auto-use is weird. The unambiguous alternative to `^` exists (`fpow`), but it's longer.
```
[                ! anonymous lambda
  dup [1,b]      ! ( n {1..n} )
  [ ... ] count  ! count the elements that satisfy the predicate...
    dupd         !   ( n i -- n n i )
    divisor?     !   ( n ? ) tests if i is a divisor of n
  2 / ^          ! halve the divisor count and raise n to the power
]
```
---
# [Factor](https://factorcode.org/), 45 bytes
```
USE: math.primes.factors
[ divisors product ]
```
[Try it online!](https://tio.run/##NY7LCsIwEEX3@YrrD5Q@rI@6FnHTjbgSFzFObbBNazIRRPz2GlqFy@UODJxTScWdHY6HfbkrcCdrqEEruR4rstLcyE278kax7szvbPSlRW@J@dVbbRiOHp6MCu8bsS8LOGUlq1qIGZgcQ5vesxNvJEiRYY4cCyyxwhpJjCRFMkcakiNdIYvxCVbbYoIFQksuqkZbJ0646qd2YQaD7uoV4zy0sv@jOs8jK4JqSNrhCw "Factor ‚Äì Try It Online")
Uses `divisors` built-in, but obviously the library import is expensive.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 6 bytes
```
*Fs{yP
```
[Test suite](http://pyth.herokuapp.com/?code=%2aFs%7ByP&test_suite=1&test_suite_input=1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A9%0A10%0A12%0A14%0A24%0A25%0A28%0A30&debug=0).
[Answer]
# [Neim](https://github.com/okx-code/Neim), 2 bytes
```
ùêÖùê©
```
[Try it online!](https://tio.run/##y0vNzP3//8PcCa1AvPL/f2MDAA "Neim ‚Äì Try It Online")
[Answer]
# [R](https://www.r-project.org/), 28 bytes
```
v=scan():1;prod(v[!v[1]%%v])
```
[Try it online!](https://tio.run/##K/r/v8y2ODkxT0PTytC6oCg/RaMsWrEs2jBWVbUsVvO/2X8A "R ‚Äì Try It Online")
[Answer]
# x86-64 Machine Code, 26 bytes
```
31 C9 8D 71 01 89 F8 FF C1 99 F7 F9 85 D2 75 03 0F AF F1 39 F9 7C EE 89 F0 C3
```
The above code defines a function that takes a single parameter (the input value, a positive integer) in `EDI` (following the [System V AMD64 calling convention](https://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI) used on Gnu/Unix), and returns a single result (the product of divisors) in `EAX`.
Internally, it computes the product of divisors using an (extremely inefficient) iterative algorithm, similar to [pizzapants184's C submission](https://codegolf.stackexchange.com/a/130466/58518). Basically, it uses a counter to loop through *all* of the values between 1 and the input value, checking to see if the current counter value is a divisor of the input. If so, it multiplies that into the running total product.
**Ungolfed assembly language mnemonics:**
```
; Parameter is passed in EDI (a positive integer)
ComputeProductOfDivisors:
   xor   ecx, ecx        ; ECX <= 0  (our counter)
   lea   esi, [rcx + 1]  ; ESI <= 1  (our running total)
.CheckCounter:
   mov   eax, edi        ; put input value (parameter) in EAX
   inc   ecx             ; increment counter
   cdq                   ; sign-extend EAX to EDX:EAX
   idiv  ecx             ; divide EDX:EAX by ECX
   test  edx, edx        ; check the remainder to see if divided evenly
   jnz   .SkipThisOne    ; if remainder!=0, skip the next instruction
   imul  esi, ecx        ; if remainder==0, multiply running total by counter
.SkipThisOne:
   cmp   ecx, edi        ; are we done yet? compare counter to input value
   jl    .CheckCounter   ; if counter hasn't yet reached input value, keep looping
   
   mov   eax, esi        ; put our running total in EAX so it gets returned
   ret
```
The fact that the `IDIV` instruction uses hard-coded operands for the dividend cramps my style a bit, but I think this is pretty good for a language that has no built-ins but basic arithmetic and conditional branches!
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 2 bytes
```
KŒ†
```
Explanation:
```
K  # Gets the divisors of a number
 Œ† # Product of array
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCJLzqAiLCIiLCIzMCJd)
[Answer]
# TI-Basic (TI-84 Plus CE), 24 bytes
```
Prompt X
1
For(A,1,X
If not(remainder(X,A
AAns
End
```
Full program: prompts user for input; returns output in `Ans`, a [special variable](http://tibasicdev.wikidot.com/ans) that (basically) stores the value of the latest value calculated.
Explanation:
```
Prompt X             # 3 bytes, Prompt user for input, store in X
1                    # 2 bytes, store 1 in Ans for use later
For(A,1,X            # 7 bytes, for each value of A from 1 to X
If not(remainder(X,A # 8 bytes, If X is divisible by A...
AAns                 # 3 bytes, ...store (A * Ans) in Ans
End                  # 1 byte, end For( loop
```
[Answer]
# C (gcc), ~~52~~ 48 bytes
```
p,a;f(x){for(p=1,a=x;a;a--)p*=x%a?1:a;return p;}
```
-4 bytes thanks to Cody Gray
A function that takes in an integer and returns the product of it's divisors.
[Try it online!](https://tio.run/##HYxBCsMgEEXXeoohENBGF2mhi0ylF@lmSGqZRY1IWoTg2a3p6sHn/Tfb1zzXGg2hV1nvfk0qutGQy0hI1up4crmn@zgRpuf2SQEilsphgzdxUN@VFw27FMfCKMVRYHAwIjDc4NI4DPxXREzN8qrrz8sE/XV5hM4AG/CKtW7fIkv9AQ)
Ungolfed:
```
int proddiv(int input) {
    int total = 1, loopvar;
    for(loopvar = input; loopvar > 0; --loopvar) {
    // for loopvar from input down to 1...
        total *= (input % loopvar) ? 1 : loopvar;
        // ...If the loopvar is a divisor of the input, multiply the total by loopvar;
    }
    return total;
}
```
[Answer]
# [Shakespeare Programming Language](http://esolangs.org/wiki/Shakespeare), 353 bytes
```
.
Ajax,.
Puck,.
Page,.
Act I:.
Scene I:.
[Enter Ajax and Puck]
Ajax:
You cat
Puck:
Listen to thy heart
[Exit Ajax]
[Enter Page]
Scene II:.
Puck:
You sum you cat
Page:
Is Ajax nicer I?If so, is remainder of the quotient Ajax I nicer zero?If not, you product you I.Is Ajax nicer I?If so, let us return to scene II
Scene III:.
Page:
Open thy heart
[Exeunt]
```
Ungolfed version:
```
The Tragedy of the Product of a Moor's Factors in Venice.
Othello, a numerical man.
Desdemona, a product of his imagination.
Brabantio, a senator, possibly in charge of one Othello's factories.
Act I: In which tragedy occurs.
Scene I: Wherein Othello and Desdemona have an enlightened discussion.
[Enter Othello and Desdemona]
Othello:
  Thou art an angel!
Desdemona:
  Listen to thy heart.
[Exit Othello]
[Enter Brabantio]
Scene II: Wherein Brabantio expresses his internal monologue to Desdemona.
Desdemona:
  Thou art the sum of thyself and the wind!
Brabantio:
  Is Othello jollier than me?
  If so, is the remainder of the quotient of Othello and I better than nothing?
  If not, thou art the product of thyself and me.
  IS Othello jollier than me?
  If so, let us return to scene II!
Scene III: An Epilogue.
Brabantio:
  Open thy heart!
[Exeunt]
```
I'm using [this SPL compiler](https://github.com/drsam94/Spl) to run the program.
Run with:
```
$ python splc.py product-of-divisors.spl > product-of-divisors.c
$ gcc product-of-divisors.c -o pod.exe
$ echo 30 | ./pod
810000
```
[Answer]
# JavaScript (ES7), 32 bytes
```
n=>g=(i=n)=>i?i**!(n%i)*g(i-1):1
```
Saved a couple of bytes by borrowing Leaky's tip on [musicman's Python solution](https://codegolf.stackexchange.com/a/130458/58974).
---
## Try it
```
o.innerText=(f=
n=>g=(i=n)=>i?i**!(n%i)*g(i-1):1
)(i.value=1)();oninput=_=>o.innerText=f(+i.value)()
```
```
<input id=i type=number><pre id=o>
```
---
## Alternative (ES6), 32 bytes
```
n=>g=(i=n)=>i?(n%i?1:i)*g(i-1):1
```
[Answer]
# TI-Basic, ~~24~~ ~~14~~ 13 bytes
Saved 1 byte thanks to lirtosiast
```
:‚àö(Ans^sum(not(fPart(Ans/randIntNoRep(1,Ans
```
[Answer]
# [RProgN 2](https://github.com/TehFlaminTaco/RProgN-2), 2 bytes
```
∆í*
```
Another language with built ins for `divisors` and `product`.
[Try it online!](https://tio.run/##Kyooyk/P0zX6///YJK3///8bmQAA "RProgN 2 ‚Äì Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 bytes
-1 byte thanks to @rak1507.
```
f‚Üê√ó/‚àò‚à™‚ä¢‚à®‚ç≥
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24TD0/Ufdcx41LHqUdeiRx0rHvVu/v@obypQIk3B0OQ/AA "APL (Dyalog Unicode) ‚Äì Try It Online")
[Answer]
# [Go](https://go.dev), ~~65~~ 64 bytes
```
func p(n int)int{p,i:=1,1
for;i<=n;i++{if n%i<1{p*=i}}
return p}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=LY1BCsIwEEXXzSmGgtCYKAY30jbgwgN4hVKaMminIaSrkJO4KYKH8CjexlS7GN5i-O89nv04v23T3pq-g6FBYjjY0XnIzeDz1-TN7vQ5m4lasAUBkufpgpVYaiUVM6OrsNZUoRABDdAGaxXsVmOMzHV-cgQ2rp7Lz7NUCg6BZWkMCKUGVSXWcDwkCrG8spTfX11q3alAmeLIOcsiW13z_OcX)
### Ungolfed
* -1 swapping `==0` for `<1` (@Steffan)
```
func product(s []int) int {
	p := 1
	for _,e := range s {
		p *= e
	}
	return p
}
func divisors(n int) (d []int) {
	for i := 1; i <= n; i++ {
		if n % i == 0 {
			d = append(d, i)
		}
	}
	return d
}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bZBBSgQxEEXXySk-A0LitDLiRpzJHVy4E5HQSYZi7CSk026GPombRvAQXsA7eBvTmXF04aY-9Qver6rXt22YPqJud3pr0WnynLoYUsbCdXnxPmR3cfP16QbfIqZghjaLHg-P5LNEKdhzFnGrcMWZCwlPjZ27pH3B9fO0jM8VLGcjZ8nmIXlEPvJKNPRCfUi98KhAYX7Q-wOOKnpddKPgiy6XlUkOHmfFVgqr6jADBR2j9UaYBiSLN_4NNXw8XnNfs-dbxX9BuF79BpUnXN6lstKzF9ScXnBanKSUc8qRPU0H_QY)
[Answer]
# [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), 22 bytes
```
[:|~b/a=b'\`a|q=q*a}?q
```
## Explanation
```
[:|           FOR a  = 1; a <= input (b); a++
 b/a=b'\`a    'a' is a proper divisor if integer division == float division
~         |   IF that's true
q=q*a         THEN multiply running total q (starts as 1) by that divsor
}             NEXT
?q            Print q
```
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 18 bytes
```
n->n^(numdiv(n)/2)
```
[Try it online!](https://tio.run/##K0gsytRNL/ifpmCr8D9P1y4vTiOvNDcls0wjT1PfSPN/Wn6RRh5QzlBHwdhAR6GgKDOvBCigpKBrByTSgKo0Nf8DAA "Pari/GP ‚Äì Try It Online")
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 27 bytes
```
@(n)prod(find(~mod(n,1:n)))
```
This defines an anonymous function. 
[Try it online!](https://tio.run/##y08uSSxL/f/fQSNPs6AoP0UjLTMvRaMuF8jK0zG0ytPU1PyfmFesYWyg@R8A "Octave ‚Äì Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~52~~ 50 bytes
* Thanks @ovs for 2 bytes: `m*=n%i>0 or i`
```
i=n=input()
m=1
while i:m*=n%i>0 or i;i-=1
print m
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9M2zzYzr6C0REOTK9fWkKs8IzMnVSHTKlfLNk81085AIb9IIdM6UxcoVVCUmVeikPv/v7EBAA "Python 2 ‚Äì Try It Online")
[Answer]
# [PHP](https://php.net/), 45 bytes
```
for($p=1;$d++<$argn;)$argn%$d?:$p*=$d;echo$p;
```
[Try it online!](https://tio.run/##K8go@G9jX5BRwKWSWJSeZ6tkZKJk/T8tv0hDpcDW0FolRVvbBixjrQmmVFVS7K1UCrRsVVKsU5Mz8lUKrP//BwA "PHP ‚Äì Try It Online")
[Answer]
# Mathematica, 17 bytes
for those who can't view deleted answers (DavidC's answer), this is the code in Mathematica with the help of @MartinEnder
```
1##&@@Divisors@#&
```
[Answer]
## Python 3, 45 bytes
`lambda _:_**(sum(_%-~i<1for i in range(_))/2)`
Let `x` be a number. Both `y` and `z` will be divisors of `x` if `y * z = x`. Therefore, `y = x / z`. Let's say a number `d` has 6 divisiors, due to this observation the divisors will be `a`, `b`, `c`, `d / a`, `d / b`, `d / b`. If we multiply all these numbers (the point of the puzzle), we obtain `d * d * d = d ^ 3`. In general, for `e` with a number of `f` divisors, the product of said divisors will be `e ^ (f / 2)`, which is what the lambda does.
[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRId4qXktLo7g0VyNeVbcu08YwLb9IIVMhM0@hKDEvPVUjXlNT30jzP1w0J7O4RAMiZahjaKipqR1taKRjaKJjBESmOkYWOsYGsVZcCgoFRZl5JRppGpmamv8B "Python 3 ‚Äì Try It Online")
[Answer]
# [MY](https://bitbucket.org/zacharyjtaylor/my-language/src/5ebf758a930fa4f4140d49db53b3ce8359aa1b65?at=master), 4 bytes
Hex:
```
1A 3A 54 27
```
Explanation:
```
1A - Input as an integer
3A - Factors
54 - Product
27 - Output (with newline)
```
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~52~~ 51 bytes
```
n->{int r=n,d=0;for(;++d<n;)r*=n%d<1?d:1;return r;}
```
[Try it online!](https://tio.run/##NY5Ba8MwDIXv/RWiEEiW1DT0VscrPe4wdig7jR28OC7OUtnISiGU/PbM7baDeEJ6evp6fdUbHzrszfcSxq/BtdAOOkZ41Q7htgL4m0bWnOTqnYFL2uUnJofnj0/QdI7FwwrQpzwxshuEHbFl51G8IL@jpuktdKTZE1i14Ob55pCBFFZGbaX1lMuyNA3Kgp4UZqapD2ZfS@p4JASS8yIfD5IT8vspgoJaJmkU7LapKct/CIDTFLm7CD@yCImSbb7OdmYPmclwXQFWYIUOYZiOMeHlWBS/6fPqXvPyAw "Java (OpenJDK 8) ‚Äì Try It Online")
Thanks LeakyNun for saving 1 byte!
]