Linked Questions
17 questions linked to/from Find the Factorial!
-2
votes
6
answers
538
views
Double Factorial [duplicate]
Challenge
The objective is simple, in the shortest amount of bytes, write a function or program that takes a number and prints its double factorial.
The input must be taken from stdin or a function ...
149
votes
330
answers
42k
views
Fibonacci function or sequence
The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first ...
162
votes
61
answers
38k
views
Tips for golfing in C
What general tips do you have for golfing in C? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C (e.g. "remove comments" is not an ...
54
votes
146
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/...
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$$...
37
votes
30
answers
4k
views
Factorials and never ending cycles!
As you may know it, the factorial of a positive integer n is the product of all the positive integers which are equal or smaller to ...
29
votes
31
answers
3k
views
Deranged !Combinatorics: Compute the Subfactorial
The subfactorial or rencontres numbers (A000166) are a sequence of numbers similar to the factorial numbers which show up in the combinatorics of permutations. In particular the nth subfactorial !n ...
19
votes
36
answers
2k
views
Mathematical Combination
Write a program that takes an input such as:
n,k
which then computes:
$$\binom n k = \frac {n!} {k!(n-k)!}$$
and then prints the result.
A numerical example:
...
27
votes
19
answers
5k
views
Last non-zero digit of n!
Given an integer 1 ≤ N ≤ 1,000,000 as input, output the last non-zero digit of N!, where ! is the factorial (the product of all numbers from 1 to N, inclusive). This is OEIS sequence A008904.
Your ...
31
votes
14
answers
2k
views
Array Escape - get out of there
One day you awake only to find yourself caught in an array. You try to just walk out of there, taking one index at the time, but it seems there are other rules:
The array is completely filled with ...
28
votes
13
answers
2k
views
Tips for golfing in Swift
What are some tips for code-golfing in Swift? Its focus on safety seems to make it difficult to golf in, but that makes little tips and even more useful. Are there any features in Swift that may help ...
23
votes
13
answers
1k
views
Generalised multi-dimensional chess knight's moves
Multi-dimensional chess is an extension of normal chess that is played on an 8x8x8x8... "board".
In normal 2D chess, a knight's move is a movement by a vector of \$ \begin{bmatrix} \pm 2 \\ \...
14
votes
15
answers
1k
views
Am I a Pillai prime?
A Pillai prime is a prime number \$p\$ for which there exists some positive \$m\$ such that \$(m! + 1) \equiv 0 \:(\text{mod } p)\$ and \$p \not\equiv 1\:(\text{mod }m)\$.
In other words, an ...
13
votes
19
answers
3k
views
How much candy can you eat?
Credit to Geobits in TNB for the idea
A post without sufficient detail recently posited an interesting game:
2 children sit in front of an array of candy. Each piece of candy is numbered 1 to ...
33
votes
6
answers
16k
views
Python workarounds for assignment in lambda
This is a tips question for golfing in Python.
In Python golfing, it's common for a submission to be a function defined as a lambda. For example,
...