lychrel.lychrel

A collection of functions to play with Lychrel numbers and other funny mathematical problems

Functions

collatz(start)

Collatz conjecture sequence

fibonacci(number[, p, q])

Generalized Fibonacci sequence (aka Lucas sequence) The number F(n) is computed with the following formula: F(n) = p*F(n-1) - q*F(n-2), where p and q are two integers.

find_lychrel_palindrome(number[, max_iterations])

Find the first palindrome produced by reverse-and-add routine (including number of iterations needed)

is_lychrel_candidate(number[, iterations])

Check whether the input is a possible Lychrel number

kaprekar(number[, base, max_iterations])

Kaprekar's routine

read_out_loud(number)

Given a number, this function compute the sequence of digits resulting from reading out loud the number, grouping together multiples of the same digit if any.