Golomb's wobbly sequence
Mathematica, 69 68 bytes

Thanks to Martin Ender for finding an extra –1 byte for me!

Last@Nest[{##&amp;@@#,1//.x_/;x==Last@#||#~Count~x==#[[x]]-&gt;x+1}&amp;,{},#]&amp;


Unnamed function taking a positive integer n as input and returning a positive integer. We construct the entire list of the first n elements of this sequence, then take the Last element. The list is constructed by starting with the empty list {} and operating on it with a function n times in a row (via Nest).

The function in question is {##&amp;@@#,1//.x_/;x==Last@#||#~Count~x==#[[x]]-&gt;x+1}&amp;, which takes a partial list of sequence values (essentially ##&amp;@@#) and appends the next value to it. The next value is computed by starting with x=1, then repeatedly replacing x by x+1 as long as the condition x==Last@#||#~Count~x==#[[x]] is met—in other words, if either x is the previous element, or else x is already in the list the correct number of times. This function spits some errors, since (for example) we shouldn't be calling the xth element of the initial list {}; however, the values are all correct.