# Prime Factorial [duplicate]

For the purposes of this question, the prime factorial of a number n is the result of multiplying all prime numbers smaller than n, and then multiplying the result by n.

Write a program or function to find the prime factorial of a number, as outlined above.

## Input:

An integer n where n is greater than one, and the prime factorial of n is smaller than the largest integer your language can support. However, remember this standard loophole. Reasonable integer limits only.

## Output:

The prime factorial of the input.

## Test Cases:

4  -> 24
7  -> 210
32 -> 641795684160


## Scoring:

This is , lowest score in bytes wins!

## marked as duplicate by xnor code-golf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Oct 1 '17 at 21:02

• No way we haven't had this challenge before... – xnor Oct 1 '17 at 21:01
• @xnor This? – H.PWiz Oct 1 '17 at 21:01
• I didn't think of searching for "primorial" when I was dupe-checking. Sandbox didn't catch it either. – Gryphon Oct 1 '17 at 21:04
• @Gryphon Yeah, it's strange that "prime factorial" doesn't appear on that challenge. I edited it to make it a bit more searchable. – xnor Oct 1 '17 at 21:06
• Thanks. I thought it was weird we hadn't already had something like this, but I couldn't find anything, so I posted in the sandbox, which also didn't find anything. – Gryphon Oct 1 '17 at 21:08

# Jelly, 5 bytes

’ÆRP×


Try it online!

## How?

’ÆRP×   Full program.

’       Decrement.
ÆR     Inclusive prime range.
P    Product.
×   Multiply by the input.


The non-built-in would be 7 bytes: ’ÆPÐfP×

# Pyth, 10 bytes

*Q*FfP_TSt


I'm pretty sure this can be golfed some more...

*Q*FfP_TSt     Full program, takes input from stdin and outputs to stdout
*Q             Implicitly output $input multiplied by *F The product of St(Q) All numbers less than$input (Q is added automtaically by Pyth)
fP_T       As long as they are prime

• Pretty sure you can omit the Q – Leaky Nun Oct 1 '17 at 21:04
• Can you replace St with U? – Leaky Nun Oct 1 '17 at 21:04
• 8 bytes: **FfP_TU or *F+fP_TU – Mr. Xcoder Oct 1 '17 at 21:06

# MATLAB/Octave, 23 bytes

@(n)prod(primes(n-1))*n


Try it online!

• Mobile bug.. >_> – Leaky Nun Oct 1 '17 at 21:05