This morning I woke to the sound of birds twittering and 2 cats chittering at them. Sweet sounds of home. As I lay there, I got to thinking about Fibonacci numbers. They're all over nature from number of flower petals to, well, stuff. What do they look like?
When I got up, the birds flew away and the cats settled down to watch me. Time for their breakfast. Over coffee I wrote this and through the afternoon I've messed with it. My itch has been scratched now.
I don't know how to compile & run c programs in winders (64bit numbers would be nice) without installing an IDE (nope!). Instead, I pulled out an Arduino and came up with this bit of code. And played around with it .
I started with floats but modulus calcs don't work on them. Doesn't even compile. Also found that out-range-numbers display "ovf" instead of digits. That happened at iteration 46. Changed the data type to unsigned long and it compiled.
At iteration 40, I quit the program after 10 minutes and ~10 million modulus calcs. May run it over night to test those last 5 iterations. Took that bit of code out to see how far it would go.
It ran only a bit further before it went off the rails. No warning, just garbage numbers after iteration 44. D'oh, 4.8 billion is too big to fit in 32bits. (max <4.3B). So I learned a couple things and had fun.
I've noticed some of you have been having hard week. Here's to Friday evening improving everyone's mood! Cheers!
aremmes last edited by
@barnie Get either the Windows Subsystem for Linux or Cygwin, and then you can compile C programs as if on Unix.
Rusty Vandura last edited by
@barnie Wait: what did I just read?
@aremmes And join Winders Insider? Yea, no. I've got a Rasp Pi4 running mint coulda done this one on, too. But it's in toy state now - block stock. This was the easiest way to get the job done. I was hoping gcc/plink under powershell simple.
@rusty-vandura I woke with an idea. Wrote some code to answer my questions. Had fun!
aremmes last edited by aremmes
@barnie I didn't know that WSL is tied to Windows Insider. That'd certainly put a damper on things for me. Either way, my desktop and laptop both run Linux. I'd have probably written the program in Haskell just for the lulz.
@aremmes I thought about php because I can stuff some big numbers into a string and php'll let me add them. This little test gave me enough to see how quickly the values climbed and if there is a pattern to the primes.
Just Jeepin' last edited by
If you enjoy exploring problems like that and haven't already played with this, I'd recommend looking into https://adventofcode.com.
Each December an evil mastermind presents a daily challenge, but you don't have to wait: previous years' events are available, so you can work on older problems.
Jawzx2 last edited by Jawzx2
@barnie @aremmes sometime in 2018 WSL became an installable windows feature. It's in add/remove programs and features, that installs the layer, and then you can choose your distro from windows app store. It's not a full distribution obviously, but depending how you like your package manager and stuff you can choose.
you can also Powershell that shit up if you want...
barnie last edited by barnie
@jawzx2 Thank you. I got WSL installed and rebooted. In Powershell wsl returns not found. I have no idea what your 2nd picture is about. How do I even get to wsl? I'm looking online but this admin stuff frustrates me to no end. I don't even try to balance my checkbook...
And now I'm getting a Submit error of "Forbidden"!?! For what? Huh. Reloaded the page and it works. Maybe artifact from reload pages in Chrome after the reboot didn't load everything.
Jawzx2 last edited by Jawzx2
@barnie you need to install a distro from the windows app store (don't worry, it's free) in order to USE the WSL. the WSL basically provides an API-level virtualized kernal/machine for the system to run on, but without an actual system installed it won't do anything. Go to the Windows Store from the start menu and search "linux", you'll find at least four options... Once A distro is installed you can do more shit with it, including I believe installing custom distros (though i've never done it) from the command line.
@jawzx2 This is so fucking frustrating. Half assed instructions and a trail of stuff ya gotta do before something happens that might be useful.
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007019e
The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again.
See https://aka.ms/wslinstall for details.
Press any key to continue...
Forget it guys. Thanks for the attempts to help. @jawzx2 @aremmes I'll just stick with my paltry Arduino until I get a real linux box up and running. I'm autistic and this sort of thrashing frustrates me to dithering. Why I always fed my admins so well.
awesomeaustinv last edited by
I don't know about what it looks like, but this is what a Fibonacci sequence sounds like: