Another useful site for that purpose is the Online Encyclopedia of Integer Sequences (https://oeis.org/).
A pretty successful strategy for "cheating" at Project Euler is to implement a brute force solution to get the first few numbers out of a sequence and look it up in OEIS. If you're lucky, they've already listed a closed form expression for calculating the sequence at an arbitrary index. Drop the expression into your code, and you end up with something that tends to be orders of magnitude more efficient.
Obviously it depends on the structure of the exercise, but it's somewhat surprising how far it can take you.
In reply to a dead comment:
The most common definition of natural numbers is "positive integers."
I do agree that 0 is important enough that it would have merited a mention at least.
It is somewhat controversial: according to Wikipedia
There is no universal agreement about whether to include zero
in the set of natural numbers. Today some textbooks,
especially college textbooks, define the natural numbers to
be the positive integers {1, 2, 3, ...}, while others,
especially primary and secondary textbooks, define the term
as the non-negative integers {0, 1, 2, 3, ...}.
Among mathematicians, the most common (by far) definition is the one given by Peano axioms, which include 0.
Including 0 is very convenient for a number (pun intended) of reasons, for example it makes the naturals a monoid, and it is easier to define the integers.
Pedantic: they are still a commutative monoid without 0, under multiplication with identity 1. You need 0 as the identity for addition, which is fundamental in these constructions.
I'm not sure if it is more common to say that 0 is a natural number. There's a math.stackexchange thread about this which seems to have equally many people saying that each is the more common one.
(I count 4 people saying {1,2,3,...} is more common vs 3 saying {0,1,2,...} is more common. I also notice that N_0 is used by both sides to refer "unambiguously" to the convention of the other side.)
In my experience {1,2,3,...} is used more in number theory, and {0,1,2,...} is used more in logic.
'The paradox states that all natural numbers are interesting. The "proof" is by contradiction: if there exists a non-empty set of uninteresting numbers, there would be a smallest uninteresting number – but the smallest uninteresting number is itself interesting because it is the smallest uninteresting number.'
Wouldn't the paradox have to be "all natural numbers are either interesting or uninteresting" thus creating a partition of natural numbers? Or at least "some (more than 2) natural numbers are uninteresting"?
15 comments
[ 3.0 ms ] story [ 45.7 ms ] threadA pretty successful strategy for "cheating" at Project Euler is to implement a brute force solution to get the first few numbers out of a sequence and look it up in OEIS. If you're lucky, they've already listed a closed form expression for calculating the sequence at an arbitrary index. Drop the expression into your code, and you end up with something that tends to be orders of magnitude more efficient.
Obviously it depends on the structure of the exercise, but it's somewhat surprising how far it can take you.
One comment though: the background almost made my eyeballs explode...
http://math.stackexchange.com/questions/283/is-0-a-natural-n...
(I count 4 people saying {1,2,3,...} is more common vs 3 saying {0,1,2,...} is more common. I also notice that N_0 is used by both sides to refer "unambiguously" to the convention of the other side.)
In my experience {1,2,3,...} is used more in number theory, and {0,1,2,...} is used more in logic.
'The paradox states that all natural numbers are interesting. The "proof" is by contradiction: if there exists a non-empty set of uninteresting numbers, there would be a smallest uninteresting number – but the smallest uninteresting number is itself interesting because it is the smallest uninteresting number.'
BTW, I once decided that the smallest uninteresting number is 34.
Alas, I don't recall my exact reasoning.
Doesn't that make 34 interesting? :-)