Working my way down these problems in pure C, without cheating. That means nothing more than the standard library.

No containers, dynamic arrays etc. Just realloc and free. This is Sparta!

No Bignum. Writing my own library from scratch, and learning so much along the way (Karatsuba multiplication and more ).

Obviously, C is the worst choice possible (after assembly), and many problems are trivial in Python or other higher level languages with powerful libraries. But that's a feature. The way of pain teaches so much more.

PS: C and C++ are completely different ball games. They shouldn't be lumped together. It's obvious that this groupping was made by mathematicians, not programmers.

## the Spartan way of C

### Re: the Spartan way of C

*The way of pain teaches so much more.*Really? or are you just a masochist ?!

### Re: the Spartan way of C

Depends what you are looking for by doing project Euler. If you want to improve your programming skill, the way of pain teaches more. If you just want to tick boxes as fast as possible, then you should cheat as much as possible using libraries that do all the heavy lifting for you.

For me solving problems is not the most interesting part. The journey is more important than its destination.

### Re: the Spartan way of C

Firstly, I would not characterize what you are advocating as

Here is a library you should try to implement yourself: https://hackage.haskell.org/package/arithmoi. This library was implemented by daniel.is.fischer who was a member of the Project Euler development team. You will see daniel's posts in the solution thread once you get into the 100 - 300 problem range. A while ago, I replicated a part of this library's functionality in Scala.

Since you claim to be using C, does that mean you will implement your own generic Set and Map abstractions? or will you use the C++ STL?

Anyway, this time around, I am taking an open-book approach to PE. The other day I wanted to solve a problem involving permutations, I needed a next_permutation function (this is available in C++ STL, I happen to be using a different language). I just googled and found an implementation of next_permutation on some website, and used it! In my earlier rounds on PE, I probably would have implemented next_permutation myself, but this time around, I do not wish to re-invent the wheel.

Very seriously consider learning the mathematics needed to implement arithmoi, that will really help you with PE problems!

**the way of pain**. OK, so if you are trying to improve your mathematics and programming skills by working on Project Euler. And, if you are insistent about not using third-party libraries, good for you! Learning to write Big Integer and other data-structures and algorithms by yourself is a laudable goal!Here is a library you should try to implement yourself: https://hackage.haskell.org/package/arithmoi. This library was implemented by daniel.is.fischer who was a member of the Project Euler development team. You will see daniel's posts in the solution thread once you get into the 100 - 300 problem range. A while ago, I replicated a part of this library's functionality in Scala.

Since you claim to be using C, does that mean you will implement your own generic Set and Map abstractions? or will you use the C++ STL?

Anyway, this time around, I am taking an open-book approach to PE. The other day I wanted to solve a problem involving permutations, I needed a next_permutation function (this is available in C++ STL, I happen to be using a different language). I just googled and found an implementation of next_permutation on some website, and used it! In my earlier rounds on PE, I probably would have implemented next_permutation myself, but this time around, I do not wish to re-invent the wheel.

Very seriously consider learning the mathematics needed to implement arithmoi, that will really help you with PE problems!

### Re: the Spartan way of C

Bear in mind that the grouping was made two decades ago, when C++ had diverged much less from C than it has now.

### Re: the Spartan way of C

Thanks. But I think we are not at the same level mathematically. I'm coming to PE from a programming and problem solving angle. I just had a Eureka moment in discovering the Erathostene sieve. The arithmoi stuff is way too advanced mathematically for me.open_book wrote: ↑Tue Aug 04, 2020 9:45 am Firstly, I would not characterize what you are advocating asthe way of pain. OK, so if you are trying to improve your mathematics and programming skills by working on Project Euler. And, if you are insistent about not using third-party libraries, good for you! Learning to write Big Integer and other data-structures and algorithms by yourself is a laudable goal!

Here is a library you should try to implement yourself: https://hackage.haskell.org/package/arithmoi. This library was implemented by daniel.is.fischer who was a member of the Project Euler development team. You will see daniel's posts in the solution thread once you get into the 100 - 300 problem range. A while ago, I replicated a part of this library's functionality in Scala.

Since you claim to be using C, does that mean you will implement your own generic Set and Map abstractions? or will you use the C++ STL?

Anyway, this time around, I am taking an open-book approach to PE. The other day I wanted to solve a problem involving permutations, I needed a next_permutation function (this is available in C++ STL, I happen to be using a different language). I just googled and found an implementation of next_permutation on some website, and used it! In my earlier rounds on PE, I probably would have implemented next_permutation myself, but this time around, I do not wish to re-invent the wheel.

Very seriously consider learning the mathematics needed to implement arithmoi, that will really help you with PE problems!

Regarding STL, as I said pure C, which means only pointers, realloc and free. It's not that hard to to implement stuff like that.

At the moment I stopped solving PE and working on my BigInt library. Once ready I will use it to solve some simple ones (by brute force instead of mathematical analysts )