The Hardest Maths Questions You'll Ever Try

  • Thread starter Doomotron
  • 97 comments
  • 6,985 views
Looks like you can eliminate a lot of ∂s... ;)

How? Unless you actually do the partial, to be honest I've never seen the equation before danoff posted it but it looks like some of it is thermo or fluid mechanics. Couldn't tell you anything outside of that cause I don't know anything more than that.
 
Last edited:
How? Unless you actually do the partial, to be honest I've never seen the equation before danoff posted it but it looks like some of it his thermo or fluid mechanics. Couldn't tell you anything outside of that cause I don't know anything more than that.

The winking smilie is an integral part of the argument. :) But look: ∂/∂x (6x) = 1/x (6x) = 6. Could there be anything wrong with this reasoning?

BTW, the equations are the Navier-Stokes equation in spherical coordinates. @Danoff might have chosen this form because it has a lot more symbols for the buck than the vector calculus version:

ec8991a09ac20811fda72211cb486792.png


And a million dollars (and infinite math kudos) await those who can solve this question:

Millenium Prize Question
Prove or give a counter-example of the following statement:

In three space dimensions and time, given an initial velocity field, there exists a vector velocity v and a scalar pressure field p, which are both smooth and globally defined, that solve the Navier–Stokes equations.

If you get stuck solving the Navier Stokes question, here is another easier but trickier question (seems it's hard to find one which is not solved somewere in the interwebs, so if you want to give it a go, don't google):

You have joined the Obsessive Coin Flipping Cult of GTPlanet, and -- naturally -- the amount of your annual dues will be determined by chance. First you must select a head-tail sequence of length five. A coin is then flipped (by a certified OCFCG official) until that sequence is achieved with five consecutive flips. Your dues is the total number of flips, in GTP dollars. For example, if you choose HHHHH as your sequence, and it happens to take 36 flips before you get a run of five heads, your annual OCFCG dues will be 36 GTP dollars. What sequence should you pick? HHHHH? HTHTH? HHHTT? Does it even matter?
 
The winking smilie is an integral part of the argument. :) But look: ∂/∂x (6x) = 1/x (6x) = 6. Could there be anything wrong with this reasoning?

BTW, the equations are the Navier-Stokes equation in spherical coordinates. @Danoff might have chosen this form because it has a lot more symbols for the buck than the vector calculus version:

ec8991a09ac20811fda72211cb486792.png


And a million dollars (and infinite math kudos) await those who can solve this question:



If you get stuck solving the Navier Stokes question, here is another easier but trickier question (seems it's hard to find one which is not solved somewere in the interwebs, so if you want to give it a go, don't google):

You have joined the Obsessive Coin Flipping Cult of GTPlanet, and -- naturally -- the amount of your annual dues will be determined by chance. First you must select a head-tail sequence of length five. A coin is then flipped (by a certified OCFCG official) until that sequence is achieved with five consecutive flips. Your dues is the total number of flips, in GTP dollars. For example, if you choose HHHHH as your sequence, and it happens to take 36 flips before you get a run of five heads, your annual OCFCG dues will be 36 GTP dollars. What sequence should you pick? HHHHH? HTHTH? HHHTT? Does it even matter?

Oh I don't do well with math humor, I just see the equations and do them as I'm told...sorry.
 
You have joined the Obsessive Coin Flipping Cult of GTPlanet, and -- naturally -- the amount of your annual dues will be determined by chance. First you must select a head-tail sequence of length five. A coin is then flipped (by a certified OCFCG official) until that sequence is achieved with five consecutive flips. Your dues is the total number of flips, in GTP dollars. For example, if you choose HHHHH as your sequence, and it happens to take 36 flips before you get a run of five heads, your annual OCFCG dues will be 36 GTP dollars. What sequence should you pick? HHHHH? HTHTH? HHHTT? Does it even matter?
Nope, all sequences are equally likely, so it doesn't matter.
 
Nope, all sequences are equally likely, so it doesn't matter.

Yes, all sequences are equally likely as outcome when tossing a coin 5 times. But consider this python script:
Code:
import random

coin=['H','T']

seq='HHHHH' # change this for other sequences

trials = 1000
avg = 0
for t in range(trials):
    trial='' # start a new trial
    while 1:
        trial += random.choice(coin) # add a coin flip to the trial
        if trial[-len(seq):] == seq: # check end of trial sequence for our sequence
            avg += len(trial)
            break
avg /= trials
print ('average #flips', avg)
Running this on my computer gives an average of about 60-62 flips until getting HHHHH, but only 37-39 flips until getting HHTHH. :odd: What's happening here? Is my computer broken? :nervous:
 
Last edited:
Yes, all sequences are equally likely as outcome when tossing a coin 5 times. But consider this python script:
Code:
import random

coin=['H','T']

seq='HHHHH' # change this for other sequences

trials = 1000
avg = 0
for t in range(trials):
    trial='' # start a new trial
    while 1:
        trial += random.choice(coin) # add a coin flip to the trial
        if trial[-len(seq):] == seq: # check end of trial sequence for our sequence
            avg += len(trial)
            break
avg /= trials
print ('average #flips', avg)
Running this on my computer gives an average of about 60-62 flips until getting HHHHH, but only 37-39 flips until getting HHTHH. :odd: What's happening here? Is my computer broken? :nervous:
Wow, you're right. Something odd is going on, here.
 
@tarnheld, I did a bit more playing around and came up with this:
Code:
TTTTT: average flips: 61
TTTTH: average flips: 31
TTTHT: average flips: 33
TTTHH: average flips: 32
TTHTT: average flips: 38
TTHTH: average flips: 32
TTHHT: average flips: 33
TTHHH: average flips: 32
THTTT: average flips: 34
THTTH: average flips: 36
THTHT: average flips: 41
THTHH: average flips: 31
THHTT: average flips: 34
THHTH: average flips: 36
THHHT: average flips: 33
THHHH: average flips: 32
HTTTT: average flips: 31
HTTTH: average flips: 34
HTTHT: average flips: 35
HTTHH: average flips: 34
HTHTT: average flips: 32
HTHTH: average flips: 42
HTHHT: average flips: 36
HTHHH: average flips: 33
HHTTT: average flips: 32
HHTTH: average flips: 33
HHTHT: average flips: 32
HHTHH: average flips: 38
HHHTT: average flips: 32
HHHTH: average flips: 33
HHHHT: average flips: 31
HHHHH: average flips: 62
Besides HHHHH and TTTTT taking 61-62 flips to reach, note also HTHTH and THTHT at 41-42. There's also a vertical symmetry that stays consistent from run to run.

I rewrote the code in C, and increased the # of trials from 1000 (per pattern) to 100,000. It's inside the spoiler:
Code:
/********************************************************************/
/*                                                                  */
/*                              pflipper                            */
/*                                                                  */
/*                        "Python coin flipper"                     */
/*                                                                  */
/********************************************************************/
  
/*
  This program is a translation to C of the Python program by tarnheld.
  The inspiration is this post, also by tarnheld:

  You have joined the Obsessive Coin Flipping Cult of GTPlanet, and --
  naturally -- the amount of your annual dues will be determined by chance.
  First you must select a head-tail sequence of length five.
  A coin is then flipped (by a certified OCFCG official) until that sequence
  is achieved with five consecutive flips. Your dues is the total number of
  flips,
  in GTP dollars. For example, if you choose HHHHH as your sequence, 
  and it happens to take 36 flips before you get a run of five heads,
  your annual OCFCG dues will be 36 GTP dollars.
  What sequence should you pick? HHHHH? HTHTH? HHHTT? Does it even matter?
*/
  
/*
// tarnheld's Python script:
import random

coin=['H','T']

seq='HHHHH' # change this for other sequences

trials = 1000
avg = 0
for t in range(trials):
    trial='' # start a new trial
    while 1:
        trial += random.choice(coin) # add a coin flip to the trial
        if trial[-len(seq):] == seq: # check end of trial sequence for our
sequence
            avg += len(trial)
            break
avg /= trials
print ('average #flips', avg)
*/  


#include <stdio.h> 
#include <stdlib.h>
#include <string.h>
#include <time.h>  
#include <unistd.h>


#define NUM_COINS 5
char pattern[NUM_COINS + 1];

/* Number of trials */
#define TRIALS 100000
  
/*
 The maximum number of flips per trial.  If the number of flips  
 exceeds this value, bad things will happen.  This situation   
 should be checked for, but in the interest of speed it is not.
*/
#define MAX_FLIPS 10000000
char sequence[MAX_FLIPS];


int main( void )
{
  int           i;
  int           j;
  int           k;
  char *        p;      /* pointer to end of sequence */
  int           total;
  char *        where;
  
  srand( time( NULL ) + getpid( ) );

  for ( i = 0; i < 32; i++ )
  {
    total = 0;

    /* Brute force generation of pattern because I'm feeling lazy. */
    /* Besides, it's probably a microsecond or two faster. */
    pattern[0] = i & 0x10 ? 'H' : 'T';
    pattern[1] = i & 0x08 ? 'H' : 'T';
    pattern[2] = i & 0x04 ? 'H' : 'T';
    pattern[3] = i & 0x02 ? 'H' : 'T';
    pattern[4] = i & 0x01 ? 'H' : 'T';
    
    for ( j = 0; j < TRIALS; j++ )
    {
      p = sequence;

      for ( k = 0; k < 4; k++ )
        *(p++) = ( ( rand( ) & 1 ) ? 'H' : 'T' );
      *p = 0;

      for ( ; ; )  
      {
        *(p++) = ( rand( ) & 1 ) ? 'H' : 'T';
        *p = '\0'; 
        if ( ( where = strstr( sequence, pattern ) ) != NULL )
          break;
      }
      total += p - sequence;
    }

    printf( "%s: average flips: %d\n", pattern, total / TRIALS );
  }

  exit( EXIT_SUCCESS );
}
 
If you look at all possible outcomes of three consecutive coin flips (each column is one outcome), do you notice how the 4 HH subsequences are distributed? How is that different from the 4 HT subsequences?

H H H H T T T T
H H T T H H T T
H T H T H T H T
 
BTW, the equations are the Navier-Stokes equation in spherical coordinates. @Danoff might have chosen this form because it has a lot more symbols for the buck than the vector calculus version:

ec8991a09ac20811fda72211cb486792.png

Yup, I remembered it looking hairy when I took heat transfer and could remember the name of the equation. I definitely dealt with harder stuff in grad school, but that one stuck out as a nasty looking equation that I could find easily on the interwebs.

mathtee-whatpart.jpg
 
If you look at all possible outcomes of three consecutive coin flips (each column is one outcome), do you notice how the 4 HH subsequences are distributed? How is that different from the 4 HT subsequences?

H H H H T T T T
H H T T H H T T
H T H T H T H T
I'm not sure what you're getting at here. Could you explain a bit?
 
Let's count the number of HH and HT subsequences in 3 coin flip sequences:
H H H H T T T T
H H T T H H T T
H T H T H T H T
_____________
2 1 0 0 1 0 0 0, 4 HH subsequences overall
0 1 1 1 0 1 0 0, 4 HT subsequences overall

If we want to know which subsequence is more likely to appear at least once in a coin flip sequence of 3 flips we have to count the number of favorable outcomes and divide through the number of all possible outcomes. There are 8 possible 3-coin-flip-sequences. Now which subsequence appears in more outcomes, HH or HT?
 
Let's count the number of HH and HT subsequences in 3 coin flip sequences:
H H H H T T T T
H H T T H H T T
H T H T H T H T
_____________
2 1 0 0 1 0 0 0, 4 HH subsequences overall
0 1 1 1 0 1 0 0, 4 HT subsequences overall

If we want to know which subsequence is more likely to appear at least once in a coin flip sequence of 3 flips we have to count the number of favorable outcomes and divide through the number of all possible outcomes. There are 8 possible 3-coin-flip-sequences. Now which subsequence appears in more outcomes, HH or HT?
HH and HT both appear four times, as do TH and TT, although I make note of the fact that two of the HH's and two of the TT's share a common coin. Other than that I'm still not sure where this is going.
 
Here's a simple one:

Convert 551B (base-16, AKA hexadecimal) to base-36, with letters A-Z representing the digits beyond 9.
 
Here's a simple one:

Convert 551B (base-16, AKA hexadecimal) to base-36, with letters A-Z representing the digits beyond 9.
I'll have a go at that L8R.

Edit: I guessed wrong, now I'm getting GT7.
Brilliant, I'm getting GT7!
 
Last edited:
Here's a simple one:

Convert 551B (base-16, AKA hexadecimal) to base-36, with letters A-Z representing the digits beyond 9.
FT7

I'm still investigating that coin-flipping problem that @tarnheld posted. The more I look the more convinced I become that the five-coin sequence shouldn't matter. Yet simulations indicate otherwise.
 
Brilliant, I'm getting GT7!
Quite right. I can't count.
I'm still investigating that coin-flipping problem that @tarnheld posted. The more I look the more convinced I become that the five-coin sequence shouldn't matter. Yet simulations indicate otherwise.
And, I've finally figured it out.

Distribution is the key, as @tarnheld hinted.
In any case, the best sequences to pick would be TTTTH, TTTHH, TTHTH, TTHHH, THTHH, THHHH, HTTTT, HTHTT, HHTTT, HHTHT, HHHTT, or HHHHT.

Not as good but not bad are TTTHT, TTHHT, THTTT, THHTT, THHHT, HTTTH, HTTHH, HTHHH, HHTTH, and HHHTH.

THTTH, THHTH, HTTHT andHTHHT are not quite as good as either of the groups above.

TTHTT and HHTHH are noticeably inferior, THTHT and HTHTH are even worse, and worst of all are TTTTT and HHHHH.
 
I once saw Derren Brown flip 10 straight heads in a row. How did he do it?

He spent 9 hours filming the same sequence hoping that eventually he'd get all heads.

Not really a question or answer but maybe relevant to what's was just discussed.
 
Sorry, i had this draft lingering around a while, but was under the weather and too tired to finish it.

First we need to formulate the problem: We want to know the expected value of the random variable V "length of coin flip head-tail-sequence X ending with a sequence S (the chosen sequence) of length l and not having S anywhere else as subsequence". V can take any integer value between l and ∞ (not smaller as X cannot end with S when it's smaller than S), so we can use this formula for the expected value:

E[V] = l * P("X ends with S after l coin flips") + (l+1) * P("X ends with S after l+1 coin flips") + ...

That's an infinite sum, so we need a trick to express it in a shorter form. Let's look at the probability that X ends with S after l coin flips. The probability doesn't depend on the whole sequence, just the last l characters of X. In particular, if we are just one flip away from getting a sequence that ends in S, we have a 1/2 chance of getting the right flip. If we are two flips away, we have 1/2 a chance to get to a sequence that is only one flip away, and so on. If we fail that's were the magic happens (or where the concrete sequence S finally matters): Suppose our S is HHTHH and we have a sequence ending in HH, so we are 3 coins away from success. If our next flip is T then we are just two flips away, but if our next flip is H, then we are still 3 coins away from success, as the sequence still ends with HH. This is in contrast with S=HHHHH as every T brings us back to being 5 coin flips away from success.

So we need to consider l states: S0 : 0 coins away from success, S1: 1 coins away from success, S2 : 2 coins away from success, ..., Sl: l coins away from success. Then we need to check for each state and considering our sequence S what happens when we flip another coin. For example with S=HHTHH:

S0 means we have a sequence X=...HHTHH and we are done
S1 means we have a sequence X=...HHTH and H gets us to S0 while T gets us to S5
S2 means we have a sequence X=...HHT and H gets us to S1 while T gets us to S5
S3 means we have a sequence X=...HH and H gets us to S3 while T gets us to S2
S4 means we have a sequence X=...H and H gets us to S3 while T gets us to S5
S5 means we have a sequence X=... and H gets us to S4 while T gets us to S5

How we can write down how the probabilities Pi to be in each state Si change when we flip coins: When we haven't flipped a coin, we are in state S5:

P0(0)=0, P1(0)=0, P2(0)=0, P3(0)=0, P4(0)=0, P5(0)=1

If we flip a coin after k flips, the probabilities change like this:

P0(k+1) = 0.5*P1(k)
P1(k+1) = 0.5*P2(k)
P2(k+1) = 0.5*P3(k)
P3(k+1) = 0.5*P4(k) + 0.5*P3(k)
P4(k+1) = 0.5*P5(k)
P5(k+1) = 0.5*P5(k) + 0.5*P4(k) + 0.5*P2(k) + 0.5*P1(k)

The expected value E[V] is then calculated using P0(k), the probability of getting our sequence S after k flips:

E[V] = 0*P0(0) + 1*P0(1) + 2*P0(2) + ...

Here is a python script that first does some trials of our coin flipping game, and then calculates the expected value with the method described above. If you want to try it with another sequence, you have to find out the probability changes in one step like i did for HHTHH above. I guess you could come up with a closed form solution for E[V] with more advanced math, but i leave it at that.

Code:
import random as rnd

coin=['H','T']

S='HHTHH'

trials = 10000
avg = 0
for t in range(trials):
    X=''
    while 1:
        X += rnd.choice(coin) # add a flip
        if X[-len(S):] == S: # check end of X for S
            avg += len(X)
            break
avg /= trials
print ('average # trials',avg)

P  = [0,0,0,0,0,1]
p  = [0,0,0,0,0,0]
EV = 0
for k in range(trials):
    if (k > 6 and k*P[0] < 0.0001):
        print('after ',k,' flips:')
        break
   
    EV += k*P[0] # update expected value

    p[0]=P[1]
    p[1]=     P[2]
    p[2]=          P[3]
    p[3]=          P[3]+P[4]
    p[4]=                    P[5]
    p[5]=P[1]+P[2]+     P[4]+P[5]
   
    P[0] = 0.5*p[0]
    P[1] = 0.5*p[1]
    P[2] = 0.5*p[2]
    P[3] = 0.5*p[3]
    P[4] = 0.5*p[4]
    P[5] = 0.5*p[5]
   
print('expected value for ',S,' is ~',EV)
 
I took a different approach to finding the optimum choice(s) to the original problem. For all possible combinations of flips of arbitrary length L I counted how many of them contained at least one occurrence of each possible five-coin combination.
TTTTH: 22792
TTTHH: 22792
TTHTH: 22792
TTHHH: 22792
THTHH: 22792
THHHH: 22792
HTTTT: 22792
HTHTT: 22792
HHTTT: 22792
HHTHT: 22792
HHHTT: 22792
HHHHT: 22792
TTTHT: 21848
TTHHT: 21848
THTTT: 21848
THHTT: 21848
THHHT: 21848
HTTTH: 21848
HTTHH: 21848
HTHHH: 21848
HHTTH: 21848
HHHTH: 21848
THTTH: 20825
THHTH: 20825
HTTHT: 20825
HTHHT: 20825
TTHTT: 20026
HHTHH: 20026
THTHT: 18286
HTHTH: 18286
TTTTT: 12880
HHHHH: 12880
and
TTTTH: 155980480
TTTHH: 155980480
TTHTH: 155980480
TTHHH: 155980480
THTHH: 155980480
THHHH: 155980480
HTTTT: 155980480
HTHTT: 155980480
HHTTT: 155980480
HHTHT: 155980480
HHHTT: 155980480
HHHHT: 155980480
TTTHT: 149409102
TTHHT: 149409102
THTTT: 149409102
THHTT: 149409102
THHHT: 149409102
HTTTH: 149409102
HTTHH: 149409102
HTHHH: 149409102
HHTTH: 149409102
HHHTH: 149409102
THTTH: 143218824
THHTH: 143218824
HTTHT: 143218824
HTHHT: 143218824
TTHTT: 137718495
HHTHH: 137718495
THTHT: 127448063
HTHTH: 127448063
TTTTT: 92920992
HHHHH: 92920992

Code to generate this is here:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define SEQ_LENGTH 30
#define MAX_LOOPS (1 << SEQ_LENGTH)

int count[32];

int main( int argc, char *argv[] )
{
int i;
char cbuf[6];
int coins;
unsigned s, seq;

for ( coins = 0; coins < 32; coins++ )
{
for ( seq = 0; seq < MAX_LOOPS; seq++ )
{
s = seq;
for ( i = 0; i < SEQ_LENGTH - 5 + 1; i++ )
{
if ( ! ( ( s & 0x1F ) ^ coins ) )
{
count[coins]++;
break;
}
s >>= 1;
}
}
}

cbuf[5] = '\0';
for ( i = 0; i < 32; i++ )
{
cbuf[0] = ( i & 0x10 ) ? 'H' : 'T';
cbuf[1] = ( i & 0x08 ) ? 'H' : 'T';
cbuf[2] = ( i & 0x04 ) ? 'H' : 'T';
cbuf[3] = ( i & 0x02 ) ? 'H' : 'T';
cbuf[4] = ( i & 0x01 ) ? 'H' : 'T';
printf( "%s: %d\n", cbuf, count );
}

return( EXIT_SUCCESS );
}
 
@BobK, nice approach! You're counts are slightly too high though, for example for 7 flips and the sequence HHTHH your program gets 12 possible hits, but it seems it's only 7:

1 HHTHH
2 HHHTHH
3 THHTHH
4 HHHHTHH
5 HTHHTHH
6 THHHTHH
7 TTHHTHH

I think you're counting some occurrences twice, maybe you need to incorporate the length of the sequence the number seq in your program represents and check that the sequence only appears at the end. BTW, you can divide the counts (change the type to double first) by 0.5 each time the sequence gets one coin longer, then you have the probabilities of getting the sequence for a given number of coin flips. Then the numbers don't overflow so quickly. The expected values can also be calculated by your program, just add up the probabilities for each coin flip length multiplied by the length. 👍

Word problems are to math as practicing scales is to making music or soccer practice drills to the playing soccer -- boring chores. It's sad that most people seem to think that's all about math, but try to see the beauty in a proof without words of this sum formula:

1+2+3+4+...+n = (n*n)/2 + n/2:

sum-of-natural-numbers.png
sum-of-natural-numbers3.png
sum-of-natural-numbers2.png

Ok, math jokes, here is my favorite:

How does a mathematician solve the problem of constipation?
He works it out just with pen and paper.
 
@BobK, nice approach! You're counts are slightly too high though, for example for 7 flips and the sequence HHTHH your program gets 12 possible hits, but it seems it's only 7:

1 HHTHH
2 HHHTHH
3 THHTHH
4 HHHHTHH
5 HTHHTHH
6 THHHTHH
7 TTHHTHH

I think you're counting some occurrences twice, maybe you need to incorporate the length of the sequence the number seq in your program represents and check that the sequence only appears at the end. BTW, you can divide the counts (change the type to double first) by 0.5 each time the sequence gets one coin longer, then you have the probabilities of getting the sequence for a given number of coin flips. Then the numbers don't overflow so quickly. The expected values can also be calculated by your program, just add up the probabilities for each coin flip length multiplied by the length. 👍
Right you are. Specifically in a seven-flip sequence, there are four cases where the sequence begins with HHTHH and my routine is counting all four of them; similarly there are four sequences where HHTHH starts with the second flip, and of course four sequences where it ends with HHTHH (or, equivalently, the third flip begins an HHTHH sequence). You are correct that in terms of the original problem, once we find the HHTHH sequence we should stop flipping.

And yet, my routine still gives the right answer to the original question!

Word problems are to math as practicing scales is to making music or soccer practice drills to the playing soccer -- boring chores. It's sad that most people seem to think that's all about math, but try to see the beauty in a proof without words of this sum formula:

1+2+3+4+...+n = (n*n)/2 + n/2:

sum-of-natural-numbers.png
sum-of-natural-numbers3.png
sum-of-natural-numbers2.png
Wow, that Lockhart's Lament is an excellent article!
 
I read the reasoning behind this coin flip question a few years ago. I was as flabbergasted at the time as everyone here is now. There was an easy explanation to it which I haven't bothered looking up again while the question has been going on here. I think it's something to do with the amount of potential positions within a sequence of results where you can pick up your desired first 2 results.
 
I once saw Derren Brown flip 10 straight heads in a row. How did he do it?
That's a nice trick :)



Wow, that Lockhart's Lament is an excellent article!
Love the analogies to music or painting. :)

I was as flabbergasted at the time as everyone here is now.
It's amazing that simple coin flipping can lead to such surprising results, but it get's even better (or worse ;)): Imagine you play a game of coins with a friend: you pick a sequence of 5 heads/tails openly, then after that your friend can choose another sequence of the same length. Then you flip coins until either one of the sequences show up, making the one who chose this sequence the winner. Is this game worth trying in your position?
Check out this video if you're impatient (Derren Brown again :D)
 
Back