Sign up to access problem solutions.

Already have an account? Log in here.

You don't want to repeat yourself when trying to be efficient. Dynamic programming is the art of keeping track of results you've already computed that are useful in later computations.

The Collatz Conjecture is a famous problem in number theory. It corresponds to the following function:

\[ f(n) = \begin{cases} \frac{n}{2} & \text{ if } n \equiv 0 \pmod{2} \\ 3n+1 & \text{ if } n \equiv 1 \pmod{2} \\ \end{cases} \]

The conjecture states that for every \(n>1\) there exists a \(k\) such that \(f^k(n)=1\). In other words, given an \(n\) to start with, after iterating this function over and over again we will eventually get \(1\), no matter the starting number.

How many \(1<n<10^7\) are there such that \(k\) is odd?

**Note:** We are looking for \(k\) to be minimal. There are technically infinitely many \(k\) because \(f(1)=4\), \(f(4)=2\) and \(f(2)=1\).

**Clarification**: \(f^k(n) = \underbrace{ f(f(f(\ldots (f(x))\ldots)}_{k \text{ number of times}} \).

Sign up to access problem solutions.

Already have an account? Log in here.

Here is a set \(S\) of numbers.

There is some subset \(X \subset S\) such that all the elements of \(X\) form an arithmetic progression when sorted.

What is the largest possible value of \(|X|\)?

**Extra Credit:** Minimize the time complexity of your solution.

Sign up to access problem solutions.

Already have an account? Log in here.

Consider an image, fully-detailed, perfectly square, but initially represented as but a single, uniform pixel, the average of all of its contents. Naturally, one would wish to see more - more details, more pixels, more depth, but receiving all of this information instantaneously, perfectly, can be so... boring.

###### Image Credit: http://mentationaway.com/wp-content/uploads/2010/08/fractal.jpg

Instead, let us explore the image, piece by piece, quadrant by quadrant. The first pixel is given to us for free, and to see more, we must explore it - digging deeper, one 'pixel' may be split into four, each being the average of the top-left, top-right, bottom-left, and bottom-right subspaces it covers respectively, all equal in size. Each of these, we may then, in turn, explore, revealing more and more detail as we go, until the pixels revealed are, in fact, pixels, yielding no further detail than themselves.

In this way, what was once a fixed, linear journey - row by row, column by column - has become something much richer! There are many different *ways* one could reveal the full landscape, many different paths one could take to reveal each detail. For a \(1 \times 1\) image, or a \(2 \times 2\) image, there is but one way forward, but for a \(4 \times 4\) image, there are \(24\) ways to reveal everything! One touch on the center to reveal \(4\) distinct \(2 \times 2\) 'pixels', which can, of course, be explored in \(4!\) different orders to reveal the entire contents of the landscape. However, this number gets much richer, very quickly.

A \(8 \times 8\) image can be fully explored in \(3892643213082624\) ways. That's right, over \(3\) *quadrillion* paths can be taken.

Let \(N\) be the number of ways a \(512 \times 512\) landscape can be fully explored. The number \(N\) has over three-hundred thousand decimal digits, so calculating it is no mere pencil-and-paper operation.

What is the digit-sum of \(N\)?

Inspired by this class of interactive animation.

(Took me a while to find a link! Hard to search for, these were somewhat popular a couple years ago.)

Sign up to access problem solutions.

Already have an account? Log in here.

×

Problem Loading...

Note Loading...

Set Loading...