Number Sequence


In the twelve months from March 2013 to March 2014, I programmed solutions to the problems posted on the Contest Coding blog run by Lewis Cornwall, solving 33 problems (out of 47) and achieving a position of 4th on the leaderboard (out of 23).

As that blog has now been discontinued, I’m posting here the solutions I programmed to those problems.

Number Sequence

A number sequence begins as follows:

6, 10, 14, 18, 22

If 6 is the first term, and 10 the second, find the one billionth term.

Solution and answer (

Solution and answer for problem "Number Sequence" (3rd November 2013) of

Sun Nov 03 09:00:00 GMT+00:00 2013


Sun Nov 03 09:00:00 GMT+00:00 2013

Solution programmed in Java using Metrowerks CodeWarrior IDE 2.1 (Discover Programming Edition); solution took ~1s to run on a 80MHz PowerPC 601.

import java.util.Date;

public class Number_Sequence
  public static void main( String p[] )
    System.out.println( new Date());

    long term = 1000000000;
    term = term * 4 + 2;
    System.out.println( "\n" + term + "\n" );

    System.out.println( new Date());

No Responses Yet to “Number Sequence”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: