From the Project Euler website:
"Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems."
"Solving the first 100 Project Euler problems in as many languages" does the trick and is only one character longer.
lcm(3, 5) = 15. So there is a repeating cell of values every 15 which we can take advantage of:
0, 3, 5, 6, 9, 10, 12,
+ 15 -> 15, 18, 20, 21, 24, 25, 27,
+ 15 -> 30, 33, 35, 36, 39, 40, 42
The last cell ending in 1000 is incomplete. Nim
Nim is the language that impressed me the most in this batch. Everything I thought would be a problem (significant whitespace, choose-your-own-function syntax, intermediate C compliation step) didn't bother me at all. The small sample of the standard library I played with was a little quirky, but Nim seems like excellent bang for your buck.
Notes:
- Release binary was only 120 KB (linked against libc)!
- Thought I'd dislike the syntax, but it was fine
- Really easy to get started, many things "just worked" (e.g. grabbing a slice of an array)
- Didn't have to specify too many types, but still ran fast
- Fast compilation
- Didn't like the "hints" it spews out during compilation, even for nim r (build and run)
- Why did all take an anonymous function, but foldl took just an expression (with a and b seemingly picked out of thin air) -- is foldl a macro?
- Nim might be a good language for hobby projects because it's easy, fast, and produces small binaries
- I wonder what the debugging experience is like -- if it's decent, I might be writing a lot more Nim in the future!
This exactly my thoughts on Nim and why I use it almost exclusively for all my hobby projects.0-https://log.schemescape.com/posts/programming-languages/100-...
> 8080 assembly (Altair 8800) > > First time I've heard of binary-coded decimals
I’m really surprised with that, that someone with such broad interests never heard of BCD. I mean, there’s is always something new to learn all the time, don’t get me wrong, nothing to criticize, just plain surprised. Wonder if that is just something older people came across?
It was really nice to read about the author's impression of each language.
Well done
I'm not sure why you would want to solve it many times and committing those solutions to memory? I think you would be better off using some of the time to just read some text books?
For some of Project Euler https://www2.math.upenn.edu/~wilf/gfology2.pdf is a good math book to consult. The techniques in there will allow you to solve some of the problems with just pen and paper (and perhaps a pocket calculator, if you are too lazy to do the arithmetic by hand, but no need for a full blown programmable computer), especially the first few problems if memory serves right. Eg where they ask you to add up the first few billion even terms of the Fibonacci numbers and similar; you can just derive a simple closed formula and evaluate that by hand.
I keep learning math (and, sometimes, relatively new development in math) by solving problems. To start, I would recommend reading G.H. Hardy & E.M. Wright "An Introduction to the Theory of Numbers".
With LeetCode -- this is more traditional exercise in coding. I did not pay much attention to it. So, sorry, cannot provide any advice
It’s alien code now.
Some other collection could be used for demonstration of skills and languages.
> the rule about sharing solutions outside of Project Euler does not apply to the first one-hundred problems
If you can provide a link, I would be really grateful!
> I learned so much solving problem XXX, so is it okay to publish my solution elsewhere?
> It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, that will rarely be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.
> However, the rule about sharing solutions outside of Project Euler does not apply to the first one-hundred problems, as long as any discussion clearly aims to instruct methods, not just provide answers, and does not directly threaten to undermine the enjoyment of solving later problems. Problems 1 to 100 provide a wealth of helpful introductory teaching material and if you are able to respect our requirements, then we give permission for those problems and their solutions to be discussed elsewhere.
You could say that providing code in an obscure language isn't really to "instruct methods", but I think it's within the spirit of the rules.
as i mentioned, i read home page years ago. in that time, third paragraph did not exist and 1-100 were considered a challenge. the language of request changes since that times.
For what it's worth, when I was doing Project Euler myself, I never had a problem _not_ looking up solutions.
Besides other things, there is a place to publish interesting solution: it is Project Euler forum to discuss solved problems.
Does releasing the Putnam answers make winning a mathematics olympiad less meaningful, after all I can copy those answers easily.
Does learning how to implement distributed locking besmirch Lamport’s legacy?
Even still, the project itself approves of releasing solutions to the top 100 problems.
Dynamic type language is what you want but static type language is what you need [TM].
Concluding there are no statically typed languages is only possible if you can't recognize them.
It's a language guys. It won't give you a BJ