I've been toying around here using Python as my language and it's quite satisfying so far. What nice about python for doing this:
- Strings and integers are easily changed back and forth.
e.g.
if a=12345, and I want the 4th digit as an integer:
String way: a4=int(str(a)[3])
i.e. convert a to string, grab index 3 (0 is first), and convert back to int.
Of course there's an integer method too which can render this specific argument moot (a4=(a//10)%10) but it is still useful for other examples. - Integers have no size limit. So no need to rely on outside modules for "big" numbers - i.e. numbers that are actually long strings.
- Python list ('array' sort of...) manipulation is very very simple. Reading in data and organizing strings is incredibly easy. Growing a list is a basic operation. If this were C, we'd have to use another class, such as vector.
- List elements can be anything. String, integers, more lists etc.
I'll try posting a few Euler solutions in subsequent posts as it's actually somewhat relaxing.
http://projecteuler.net/
No comments:
Post a Comment