Rand Stats

Math::Zeckendorf

zef:coke

NAME

+Actions Status

Math::Zeckendorf

Given an Int, generate the Zeckendorf decomposition of that number.

SYNOPSIS

use Math::Zeckendorf;

say zeckendorf(27);
# OUTPUT: «[1 0 0 1 0 0 1]␤»

say zeckendorf(27, :numbers);
# OUTPUT: «[21 5 1]␤»

DESCRIPTION

Inspired by the "Base Fibonacci" Numberphile video.

See also Zeckendorf's theorem on wikipedia.

AUTHOR

Will Coleda will@coleda.com

COPYRIGHT AND LICENSE

Copyright 2026 Will Coleda

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.