Linked Questions

145 votes
304 answers

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 ...
user avatar
48 votes
90 answers

Is this number a factorial?

The Task Given a natural number as input, your task is to output a truthy or falsey value based on whether the input is a factorial of any natural number. You can assume that the input number will ...
user avatar
  • 4,928
43 votes
83 answers

Division and remainder

This challenge, while probably trivial in most "standard" languages, is addressed to those languages which are so esoteric, low-level, and/or difficult to use that are very rarely seen on this site. ...
user avatar
  • 11.8k
50 votes
73 answers

It's Hip to be Square

Challenge So, um, it seems that, while we have plenty of challenges that work with square numbers or numbers of other shapes, we don't have one that simply asks: Given an integer ...
user avatar
  • 35.5k
45 votes
65 answers

An abundance of integers!

An Abundant number is any number where the sum of its proper divisors is greater than the original number. For example, the proper divisors of 12 are: ...
user avatar
  • 57.1k
61 votes
42 answers

Find the Smoothest Number

Your challenge is to find the smoothest number over a given range. In other words, find the number whose greatest prime factor is the smallest. A smooth number is one whose largest prime factor is ...
user avatar
  • 41.3k
43 votes
42 answers

Fibonacci reversed!

Introduction We all know and love our Fibonacci sequence and have seen a myriad of challenge on it here already. However, we're still lacking a very simple case which this answer is going to provide: ...
user avatar
  • 3,253
34 votes
37 answers

Previous Fibonacci number

The sequence of Fibonacci numbers is defined as follows: \$ F_0 = 0 \\ F_1 = 1 \\ F_n = F_{n-1} + F_{n-2} \$ Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not ...
user avatar
  • 21.2k
29 votes
33 answers

Find the closest Fibonacci Number

We are all familiar with the famous Fibonacci sequence, that starts with 0 and 1, and each element is the sum of the previous ...
user avatar
  • 41.4k
21 votes
21 answers

Fibonacci Encoding

Fibonacci coding is a universal code, which can encode positive integers of any size in an unambiguous stream of bits. To encode an integer \$ n \$: Find the largest Fibonacci number less than or ...
user avatar
  • 21.2k
19 votes
5 answers

Is this a losing square?

There is a game called Get Home that is played on the a chess board. In this game there is a single piece that is moved by both players in turns. There are some rules to how the piece can be moved. ...
user avatar
  • 88.1k
6 votes
6 answers

Lucas and Fibonacci are in pair

Influenced by Non-discriminating Programming, I made up an idea of a similar challenge. Here, we say a string is a Lucas string if the number of appearances of each character is a Lucas number (2, 1, ...
user avatar