Finding the next number in sequence
This is one of those times when working backwards helps... but, before we get to that...

Nit Picks


Unless you have a really good reason, do not use StringBuffer. Use StringBuilder instead. There are two times to use StringBuffer, when you are modifying the instance from multiple threads, and when you are using a Matcher.appendReplacement() or Matcher.appendTail(). You are doing Neither, so stick with StringBuilder. It's faster.
You should give values some breathing space... use white-space to make things readable. This is not JavaScript where whitespace impacts download time! Lines like:


while(i&lt;=N){



should be:

while (i &lt;= N) {

Having both the variables begin and start is confusing.
It irks me that you hard-code the first result.... why have:


    // populate next number in sequence
    current.append(1);
    current.append(1);




A Better way.

The actual processing for this is simpler if we do some clever backward-forward logic. I spent some time 'doing it differently'... The trick is that you want to extract a function that does it for a single iteration.... so, let's start with the outer function (so it makes sense):

public static final void loopCompute(String input, int count) {
    System.out.println(input);
    for (int i = 0; i &lt; count; i++) {
        input = compute(input);
        System.out.println(input);
    }
}


I have called it loopCompute, and it takes an input String, and a number of times to iterate. It then loops the number of times, and computes the result, and prints the result. It then prints the new result.

So, what about the compute method?

Well, the trick is to count the sequences of digits, but also, the better trick is to start at the end and work backwards, because we can then use those values to build up the output String efficiently working forwards.

private static final String compute(String source) {
    // allocate two mated arrays, one of the digits, the other of the counts.
    // the worst case is that there will be as many counts as input digits
    // so we budget for the worst case.
    char[] digits = new char[source.length()];
    int[] counts = new int[source.length()];

    int pos = -1;
    // work backwards through the input, storing the results forwards in the arrays.
    for (int i = source.length() - 1; i &gt;= 0; i--) {
        if (pos &lt; 0 || source.charAt(i) != digits[pos]) {
            pos++;
            digits[pos] = source.charAt(i);
        }
        counts[pos]++;
    }

    // now work backwards through the counts, and store them forwards in the StringBuilder.
    StringBuilder sb = new StringBuilder(pos * 2);
    while(pos &gt;= 0) {
        sb.append(counts[pos]).append(digits[pos]);
        pos--;
    }
    return sb.toString();
}