Q:

Different way int n can be split in groups of 1 or 2

This is the question posed to me for an assignment:

A patient has n pills to take. In each day, he can take either one
  pill or two pills until all pills are gone. Let T(n) denote the number
  of different ways the patient can take all n pills. Give a closed form
  for T(n). (Note that – for example – the two sequences (1, 2, 2) and
  (2, 1, 2) are considered as two different ways of taking 5 pills.)

I have tried to work the sets for n = 1 through 8 to see if I can find a pattern like so:

n=1 {1} n=2 {{1,1},{2}} n=3 {{1,1,1},{1,2},{2,1}} n=4
  {{1,1,1,1},{1,1,2},{1,2,1},{2,1,1},{2,2}} ...

But haven't been able to.  Combinations from n=1-8 are 1,2,3,5,8,12,18,25
Anyone have an idea?

A:

Your example shows wrong values after 8 (should be 13...).
Consider the next approach: in the last day patient can eat the one pill or two pills (n = (n-1) + 1  or n = (n-2) + 2 ). So number of ways to compose T(n) value is
T(n) = T(n-1) + T(n-2)

Repeat the same process with T(n-1) and T(n-2) and you'll finish at T(0) or T(1) - these values apparently are equal to 1.
So build recurrent sequence and solve recurrence for any n. 
Note that you can unwind recurrence from the end (recursion method) and start from the 0/1 - iteration method. 
When you find correct values, you might discover that they form famous sequence and read more about  it.

