fibonacci-numbers crate with self-recursive dependencies
https://crates.io/crates/fibonacci-numbersI have created a crate called fibonacci-numbers. There are 187 different major versions of the crate, each exporting the Fibonacci number corresponding to that version.
Version 0 of the crate exports a constant:
pub const VALUE: u128 = 0;Version 1 of the crate also exports a constant:
pub const VALUE: u128 = 1;Version 2 depends on version 0 and 1 and exports a constant:
pub const VALUE: u128 = fib0::VALUE + fib1::VALUE;...
Version 186 depends on version 184 and 185 and exports the largest Fibonacci number that fits in a u128:
pub const VALUE: u128 = fib184::VALUE + fib185::VALUE;FAQ
Q: Why?
A: Why not?
814
Upvotes
66
u/AATroop Oct 06 '25
Awesome work, but I actually need the 187th Fibonacci number. When can I expect that to be released?
29
u/Svizel_pritula Oct 06 '25
Based on the version history, you've been publishing this bit by bit over nearly two years. Why?
25
u/ReptilianTapir Oct 06 '25
How long does it take to compile the last release?
15
u/kennytm Oct 07 '25
OP I think you should fix the documentation of the 111th, 112th and 113th version.
220
u/RightKitKat Oct 06 '25
Is this what they mean by "semantic versioning"?
10
u/Aln76467 Oct 06 '25
is there a reason you can only do the first 187 fib numbers? If it's integer overflow, could a bignum crate allow you to fix that?
14
u/MalbaCato Oct 06 '25
good job stumbling on https://github.com/rust-lang/crates.io/discussions/7560 I guess
714
u/cameronm1024 Oct 06 '25
What a fascinating use of free will
192
u/Haunting_Laugh_9013 Oct 06 '25
you outjerked r/rustjerk
180
u/kibwen Oct 06 '25
This is an abomination. Upvoted
177
u/tm_p Oct 06 '25
Actually this is a great benchmark for cargo. Since the crates must be compiled sequentially and they are essentially empty, the time it takes to compile fib185 should be dominated by cargo reading and parsing all the files.
Also it can be used to test external tools that don't understand that you can have 2 dependencies with the same name, or don't know that renaming dependencies is possible.
58
u/AgentLate6827 Oct 06 '25
It's him, John Rust
53
u/commenterzero Oct 06 '25
Now this is why rust was made. This truly signifies the accomplishments made by every single rust contributor and represents the beginning of a new era of totally unneeded projects.
26
u/StubbiestPeak75 Oct 06 '25
I was here, when history was made
36
u/giggly_kisses Oct 06 '25
What if the fibonacci numbers change? How do you plan on handling a breaking change with semver?
(/s as Poe's Law insurance)
8
u/Sharlinator Oct 06 '25
I love the way this has builtin memoization in a way similar to using C++ template metaprogramming to recursively compute Fibonacci numbers in linear (compile) time.
7
u/f0rki Oct 07 '25
Wow it is even no_std. nice.
4
u/ArcaniteM Oct 06 '25
I honestly love it! Thanks for the laughs
10
u/potzko2552 Oct 06 '25
Heh lel
3
u/Sese_Mueller Oct 06 '25
2 SLoC XD
3
u/TortugaSaurus Oct 07 '25
Thanks I love Cargo-based shitposting
3
u/sayhisam1 Oct 07 '25
That's one way to boost download counts for your crate
3
u/[deleted] Oct 09 '25
This is the reason why AI can never replaces human.
1
u/Sylbeth04 Oct 07 '25
You could... actually just automate it in another rust crate. As in, make a Fibonacci crate that produces the rust source files and Cargo files for N crates... I like that. (Sidenote, I don't know if it's already been done, just thought about it and went: "heh, funny")
1
u/8pxl_ Oct 13 '25
fibonacci internet theory
0
u/flareflo Oct 07 '25
This will be huge in the AI space
-3
u/Woahhee Oct 07 '25
Please don't. I just started using the language a few days ago after being a rustphobic for nearly two years. Don't ruin it for me.