Grv wrote:There is a small gap in your solution - a set of numbers you dont account for.
If n is not divisibe by 3, then it can be either of these forms
n = 3k + 1 as well as n = 3k + 2.
If you only do, you are missing half the numbers like 8, 11 etc.
in my solution, no gap.
note the following:
if you're referring to my treatment of statement (2), then, yes, i didn't consider all possibilities. this is because i didn't have
as soon as we find 2 examples that give contradictory answers, we have "insufficient", and we are done
. to consider further examples at that point would be a complete waste of time.takeaway:
once you're established "insufficient", do not bother testing additional cases!
the fact that n = 2 and n = 5 are both of the form (3k + 2) is random coincidence.
if you look at the treatment of the 2 statements together, i have included both (3k + 1) and (3k + 2)-type cases in that treatment. unlike statement (2) alone, the combination of the 2 statements turns out to be sufficient, so this time i must
consider all of the possibilities.
therefore, i do.
note the following statement:
Ron Purewal wrote:if n is not divisible by 3, then exactly one of (n - 1) and (n + 1) is divisible by 3
if n - 1 is divisible by 3, then n has the form 3k + 1.
if n + 1 is divisible by 3, then n has the form 3k + 2.
both have been considered.