Wednesday, November 19, 2014

Week 6

I already used floor and ceiling a number of times before, so the concept was not new to me, just the formal definition. This week, there was only 2 classes and they were both solving example problems, so there's not too much to talk about. In the proof ∀n ∈ N, n^2 + n is even, I am wondering why it is better to factor it to n(n+1), why can't you just try n as an odd and even in n^2 + n? Here I will do it without factoring. It's obviously not a formal proof, just a confident thought process.

Let our even number = 2
Let our odd number = 1

n^2 + n
Odd n = 1^2 + 1 = 2 = Even

n(n+1)
Even n = 4 + 2 = Even

n*n will always produce an even if it's even and odd if it's odd. Adding 2 odd produces even and adding 2 evens produces even also. It's all evens!

Saturday, November 1, 2014

Week 7

We received a problem in class called "penny piles". Starting with 64 pennies in one drawer and none in the other.

2^6 = 64
2^5 = 32
2^4 = 16
2^3 = 8
2^2 = 4
2^1 = 2
2^0 = 1

This pattern sure looks a lot like how binary numbers are calculated!

You can move half of the drawer to the other, as long as it contains an even amount of coins. The even numbers seem to be the easiest to achieve the most of. The odd numbers raise the most obvious concern. I think I will look at a few examples to examine this first.

64 achievable
63 will have the steps (64,0), (32,32), (48,16), (56,8), (60,4), (62,2), (63,1)
62 achieved above.
61... that will correspond to 3 on the other side. If I multiply 3 by 2, I can see some of the path that will lead me to 3. So: 6, 12, 24, 48. So now, 61 turns to getting to 48 and then halving to 3! We know 48 = 2^5 + 2^4 = 32 + 16... (64, 0), (32, 32), (48, 16), (24, 40), (12, 52), (6, 58), (3, 61). This may be a systematic route for a program...

We will work backwards to find a path, then trace that path back from (64,0).
Step 1: Take the lower of the 2 values that sum to 64. Ex: 3 in (61,3)
Step 2: Multiply that number by 2 until you hit something that can be expressed as combination of a base of 2.
Step 3: Work from (64,0) to that combination of base of 2. Ex. If it's 48 then 32 + 16
Step 4: You can now halve that number until you get to your goal.

Who knows how much this will work, but definitely something I could code up in Python pretty quickly.