Questions tagged [factorial]
This tag is for challenges involving the factorial of a number, the product of the numbers from 1 to n
30
questions
4
votes
1
answer
229
views
Convert real numbers between factoradic and positive integer bases
This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and ...
15
votes
14
answers
2k
views
How many trailing zeros in the hyperfactorial?
We have a challenge to calculate the hyperfactorial and one to count the trailing zeros of the factorial, so it seems logical to put them together and count the trailing zeros in the hyperfactorial.
...
8
votes
7
answers
692
views
Factorials of primes decomposition
You have to decompose a positive integer/fraction as a product of powers of factorials of prime numbers.
For example
...
18
votes
3
answers
647
views
Find a factorial with n trailing zeros, quickly
Problem
A fact you may have noticed about factorials is that as \$n\$ gets larger \$n!\$ will have an increasing number of \$0\$s at the end of it's base \$10\$ representation. In fact this is true ...
4
votes
1
answer
262
views
Calculate the (n x "super")factorial [duplicate]
Introduction
Factorials are one of the most frequently used examples to show how a programming language works.
A factorial, denoted \$n!\$, is \$1⋅2⋅3⋅…⋅(n-2)⋅(n-1)⋅n\$.
There is also the ...
22
votes
22
answers
3k
views
Implement the Torian
The Torian, \$x!x\$, of a non-negative integer \$x\$ can be recursively defined as
$$
x!0 = x \\
x!n = \prod^x_{i=1} i!(n-1) = 1!(n-1) \times 2!(n-1) \times \cdots \times x!(n-1)
$$
The Torian is then ...
20
votes
9
answers
628
views
Zeroes at end of \$n!\$ in base \$m\$
Related: Zeroes at the end of a factorial
Today, we are going to calculate how many zeroes are there at the end of \$n!\$ (the factorial of \$n\$) in base \$m\$.
Or in other words: For given integers \...
57
votes
154
answers
8k
views
The vanilla factorial challenge
Task
Given a non-negative integer \$n\$, evaluate the factorial \$n!\$.
The factorial is defined as follows:
$$
n!=\begin{cases}1 & n=0\\n\times(n-1)!&n>0\end{cases}
$$
Rules
All default I/...
20
votes
9
answers
665
views
Prime Modified Z-Factorials
Let me explain one by one the above terms...
We will call \$\text{Z-Factorial}(n)\$ of a positive integer \$n\$, \$n!\$ (i.e. \$n\$ factorial) without any trailing zeros.
So, \$\text{Z-Factorial}(30)\$...
22
votes
39
answers
4k
views
Reverse factorial function
Given a number n, find x such that x! = n, where both x and n are positive integers. Assume the input n will always be the factorial of a positive integer, so something like n=23 will not be given as ...
38
votes
19
answers
7k
views
Bad factorial joke
Sometimes I make bad jokes... And a bad joke I like to make involves interpreting exclamation marks in sentences as the factorial sign.
Task
Your task is to write a program that receives a sentence ...
39
votes
41
answers
6k
views
Repeated! Factorials!
Not to be confused with Find the factorial!
Introduction
The factorial of an integer n can be calculated by
$$n!=n\times(n-1)\times(n-2)\times(...)\times2\times1$$...
32
votes
21
answers
2k
views
A Note on N!
J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):
If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$N!...
1
vote
3
answers
893
views
Finding Factorials with Gamma [duplicate]
Introduction
We know that the factorial notation is valid for all natural numbers. However, Euler had extended it for all positive real numbers, as well as for complex numbers by defining a function, ...
16
votes
5
answers
973
views
Factoring factorials
Today in my statistics class, I found that some factorials can be simplified when multiplied together! For example: 5! * 3! = 5! *3*2 = 5! *6 = 6!
Your job:
Given ...