Billboard Challenge, Part 2

June 26, 2012

In the previous exercise, we looked at a programming challenge that involved the digits of e. Solving that exercise and clicking on the indicated web site took the solver to this page:

Congratulations. You've made it to level 2. Go to and enter Bobsyouruncle as the login and the answer to this equation as the password.

f(1)= 7182818284
f(2)= 8182845904
f(3)= 8747135266
f(4)= 7427466391
f(5)= __________

Don’t try to login; the account no longer exists.

Your task is to write a program to find the next number in the sequence. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

About these ads

Pages: 1 2

4 Responses to “Billboard Challenge, Part 2”

  1. […] today’s Programming Praxis challenge, our goal is to solve the second part of the billboard test, which is […]

  2. My Haskell solution (see for a version with comments):

    main :: IO ()
    main = print $ [x | x <- map (take 10) $ tails stream_e, sum x == 49] !! 4
  3. Mike said

    The difficulty with these kinds of problems is that the given terms often do not identify a unique sequence.

    For example, I determined that the values for f(1), f(2), f(3), and f(4) start at position 2, 6, 24, and 100, respectively, in the digits of e. After a few minutes at, I discovered that the differences between successive indices–2, 4, 18, 76–correspond to the first few even Lucas numbers. So I whipped up the following Python code to calculate f(5):

    from itertools import ifilter, islice
    from myutils import accumulate, even
    def Lucas():
        '''Lucas numbers are given by: L(0) = 2, L(1) = 1, and L(n) = L(n-1) + L(n-2).  Similar to Fibonacci numbers
        a, b = 2, 1
        while True:
            yield a
            a, b = b, a+b
    for i, n in enumerate(islice(accumulate(ifilter(even, Lucas())), 5),1):
        print "f({}) = {}".format(i, ''.join(map(str, islice(e_digits(), n-1, n+9))))

    Which results in the following output:

    f(1) = 7182818284
    f(2) = 8182845904
    f(3) = 8747135266
    f(4) = 7427466391
    f(5) = 4637721112

    If you’ve looked at the Praxis solution, this is not the answer they were looking for.

  4. programmingpraxis said

    Mike: Yes, that’s a problem.

    My solution also differs from the suggested solution at A095926, because I require all numbers to be ten digits long, as in the first challenge problem, but the OEIS solution permits leading zero.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


Get every new post delivered to your Inbox.

Join 634 other followers

%d bloggers like this: