Monday, 24 August 2026

British Mathematical Olympiad 2025 round 1 Q1

Here is the question:
  1. A ramp is a sequence of three different positive integers $π‘Ž,\ 𝑏,\ 𝑐$ such that $π‘Ž$ is a factor of $𝑏$ and $𝑏$ is a factor of $𝑐$. For every prime number $𝑝$ and every positive integer $𝑛$, determine with proof whether  $p^n$ can be expressed as the sum of a ramp. 

We observe that if $a,b,c$ constitute a ramp, then we may write it as $a,\alpha a, \alpha \beta a$, where $\alpha$  and $\beta$ are positive integers $>1$. So the sum of the ramp may be written:

$$s(a,b,c)=a(1+\alpha+\alpha \beta)$$

Then, if for some prime $p$ and exponent $n$ $s(a,b,c)=p^n$, we have $a \vert p^n$, so for some $k$ such that  $n\ge k\ge 0$ we have $a=p^k$ then $(1+\alpha+\alpha \beta)=p^{n-k}$

The smallest $n$ such that $s(a,b,c)=p^n$ is the smallest $n$ such that $(1+\alpha+\alpha \beta)=p^n$. Given the conditions defining a ramp: $1+\alpha+\alpha \beta \ge 7$, so for any $p\ge 7$ put $\alpha=2$ and $\beta=\frac{p-3}{2}$. Then $1+\alpha+\alpha \beta=p$, and so for every prime $p\ge 7$, and every positive integer $n$ there is a ramp such that $s(a,b,c)=p^n$

That leaves the cases where $p=2$, $p=3$ and $p=5$ to examine.

If $p=5$, $p$ cannot be writen as the sum of a ramp. but $p^2=25$ can as if $\alpha=2, \ \beta=11$ we have $1+\alpha+\alpha \beta=p^2$ and so for $p=5$, $p^n$ can be written as the sum of a ramp for all $n\ge 2$ and no other.

A similar argument applies when $p=3$ as $p^2=9$ as $1+2+2.3=9$

In the case where $p=2$, by trial and error we find the minimum exponent $n=4$

Summary
$p^n$ can be written as a ramp for all primes $\ge 7$ and every positive exponent. 
$5^n$ can be written as a ramp for every positive exponent $n\ge 2$ and no others. 
$3^n$ can be written as a ramp for every positive exponent $n\ge 2$ and no others. 
$2^n$ can be written as a ramp for every positive exponent $n\ge 3$ and no others. 

Wednesday, 22 July 2026

STEP2-1998 Section A, Q1

This is the first part of question 1 on the exam paper. I am ignoring the second part as its solution is virtually identical to this.

Show that if $n$ is an integer, such that

$$(n-3)^3+n^3=(n+3)^3,\ \ \ \ \ \ \ (*)$$

then $n$ is even and that $n^2$ is a factor of $54$. Deduce that there is no integer $n$ which satisfies equation $(*)$

We begin by expanding as simplifying:

$$(n-3)=n^3-9n^2+27n-27$$

$$(n+3)=n^3+9n^2+27n+27$$ 

So $(*)$ becomes:

$$n^3-18n^2-54=0\ \ \ \ \ \ \ (1)$$

 We can rewrite $(1)$ as: $n^2(n-18)=54$, which as we are dealing with integers implies that $n^2$ divides $54$ ( and that $n$ is positive and $>18$. Also as the RHS of this rewrite is even then the LHS must also be even which implies that $n$ is even.

There is no $n>18$ such that $n^2 \mid 54$ so there is no integer $n$ which satisfies $(*)$


The second part of this question was:

Show that, if $n$is an integer such that

$$(n-6)^3+n^3=(n+6)^3,\ \ \ \ \ \ \ (**)$$

then $n$ is even. Deduce that there is no integer $n$ which satisfies $(**)$.

This when expanded and simplified becomes:  $n^3-36n^2-432=0$. Which implies $n$ is even and that $n>36$ and that $n^2 \mid 432$, but all $n>36$ have squares greater thatn $432$, hence there is no integer which satisfies $(**)$

Wednesday, 8 July 2026

ChatGPT writes a (quite good) Matlab function.

On Quora a question was asked about individual football match results indicating the actual relative strengths of the teams. I replied with an explanation of the Poisson model of match scores. This model assumes that on the day each team have an expected number of goals (at full time) under the conditions pertaining, and that the actual number of goals scored by each team is a Poisson distributed random variable (RV) with the expected mean.

As an example I ran some Monte-Carlo runs (in Gnu-Octave) of games with the first team having an expected number of goals of 1.2, and the second team having an expected number of 1.5. This gave a probability of team 1 winning of $\approx 0.3$ and of team 2 winning of $\approx 0.45$ and of a draw of $\approx 0.25$. I also ran this again with means of 1.2 and 3 when the results were $\approx 0,12,\ 0.74,\ 0.14$.

In conversation with a fellow dog-walker in Jubilee Park, he explained the success he was having using LLMs as code generators from text prompts. So I thought "how well could one of these LLMs do with this model?"

Here are the prompt I used, and ChatGPT's (free version) response:

----------------------------------------------------------------------------------

Prompt:

would you write a Matlab function for me that computes the probability of a random variable with a Poisson distributes with mean L1 exceeding the value of a random variable with Poisson distribution with mean L1

Response:

 I assume you meant two independent Poisson random variables with means $L_1$ and $L_2$. (Your message says both means are $L_1$, but if they are the same then the probability is simply $(1-P(X=Y))/2)$ by symmetry.)

The probability you want is

$P(X>Y),\qquad X\sim\mathrm{Poisson}(L_1)$  $Y\sim\mathrm{Poisson}(L_2)$.

A numerically stable MATLAB implementation uses the identity


$P(X>Y)=\sum_{y=0}^{\infty}P(Y=y),P(X>y)$,

and truncates the infinite sum once the remaining probability mass is negligible.

function p = poissonGreater(L1, L2, tol)
%POISSONGREATER  Compute P(X > Y) for independent Poisson variables.
%
%   p = poissonGreater(L1,L2)
%   p = poissonGreater(L1,L2,tol)
%
%   Inputs:
%       L1  Mean of X (>=0)
%       L2  Mean of Y (>=0)
%       tol Optional truncation tolerance (default 1e-12)
%
%   Output:
%       p   Probability that X > Y

    if nargin < 3
        tol = 1e-12;
    end

    if L1 < 0 || L2 < 0
        error('Means must be nonnegative.');
    end

    % Upper limit chosen so omitted tail probability is below tol
    ymax = ceil(max(poissinv(1-tol/2,L1), poissinv(1-tol/2,L2)));

    y = (0:ymax)';

    % PMF of Y
    py = poisspdf(y,L2);

    % Tail probabilities P(X > y)
    pxTail = 1 - poisscdf(y,L1);

    % Sum
    p = sum(py .* pxTail);
end

Example

>> poissonGreater(5,3)

ans =

    0.7336

Special case: equal means

If $L_1=L_2=\lambda$, then


$P(X>Y)=\frac{1-P(X=Y)}{2}$,

where

$P(X=Y)=\sum_{k=0}^{\infty}\frac{\lambda^{2k}}{(k!)^2}e^{-2\lambda}$

The function above works for this case as well. For example:

>> poissonGreater(5,5)

ans =

    0.4361

If you intended both means to be (L_1), I can also provide a much faster implementation that exploits the symmetry above and computes (P(X>Y)) directly from the equal-mean formula (or via the Skellam distribution).


--------------------------------------------------------------------------------------

This code as requested by the prompt only gives the probability that the first team wins, but a simple wrapper will give equivalent results to the Monte-Carlo simulation:

function [p1,p2,pE]=FB_2(L1,L2)
%
% my function to fill in the cases where RV2 exceeds RV1
% and that they are equal.
%
  p1=poissonGreater(L1, L2);
  p2=poissonGreater(L2, L1);
  pE=1-p1-p2;
end

Then running this gives:

>> [p1,p2,pE]=FB_2(1.2,1.5)
p1 = 0.3037
p2 = 0.4415
pE = 0.2548
>> [p1,p2,pE]=FB_2(1.2,3.0)
p1 = 0.1212
p2 = 0.7367
pE = 0.1421
>

Which are close enough to Monte-Carlo results for government purposes.

Comments on the ChatGPT code: In some respects it is better than mine in that it does input data validation, also it is better commented (I do not comment experimental code of this sort). Also I just used a script virtually as a calculator:

disp("football_1");  
ngames=10000; 
mu1=1.2; mu2=3;  
r1=rand(1,ngames);  
r2=rand(1,ngames); 
s1=poissinv(r1,mu1);
s2=poissinv(r2,mu2);  
sum(s1>s2)/ngames
sum(s1==s2)/ngames
sum(s1<s2)/ngames  

On the whole I would say I'm impressed by the performance of ChatGPT as a code generator in this instance, it even corrected the typo in the prompt!

Tuesday, 7 July 2026

Problem that I have forgotten the origin of :( ... found it:)

 Scrolling on UTube I found this problem, now I haven't watched this, the challenge is to solve it without being shown a solution.




















This problem appears to have insufficient information to be able to solve. Which if it has a unique solution means it is constant for what ever  value/s we assume for the missing data.

If this is so a common approach is to use an edge case where the solution is easiest. Here the obvious edge cases are when the distance between the walls is zero or infinite. Examination of these edge cases seems to get us nowhere, so we could just assume some value for the separation of the walls and work with that. However I think we should deal with this in a more general way. So we produce a labelled diagram:






Now we see that $\triangle$AEF is similar to $\triangle$ACB, or $x/u=6/d$, and similarly $\triangle$BDEis similar to $\triangle$BEF, or $4/d=x/(d-u)$. 

This gives us $x=\frac{6u}{d}$ and $x=\frac{4(d-u)}{d}$ equating these and simplifying gives: $u=\frac{4}{10}d$. Substituting this back into the first of the equations for $x$ and simplifying gives the answere $x=\frac{24}{10}=2.4$

As a final check lets draw a scale diagram and measure $x$ (for some value of $d$) accepting there will always be some error in the diagram and hence in the measurement:













Tuesday, 2 June 2026

Random UTube Thumbnail Question

 Scrolling through my UTube feed I spot a thumbnail with a problem statement:

Find all the real solutions to:

$$3^x . 8^{\frac{x}{x+2}}=6$$

Initial observations: $x=1$ is a solution, and $x=-2$ is not a solution.

An obvious thing to do with this is to take logs:

$$x\log(3)+\frac{x}{x+2}\log(8)=\log(6)$$

We can multiply through by $(x+2)$ to get a quadratic in $x$

$$x^2 \log(3) +x (\log(3)+2\log(2))-2(\log(3)+\log(2))=0$$

or:

$$x^2+x\left(1+2\frac{\log(2)}{\log(3)}\right) -2\left(1+\frac{\log(2)}{\log(3)}\right)=0$$

As this is a quadratic with one know real root, the other root is also real, and so there are two real solutions (assuming distinct roots).

But we know that $x=1$ is a root and so $(x-1)$ is a factor, so if $x=u$ is the other root we must have 

$$u=-2\left(1+\frac{\log(2)}{\log(3)}\right) \approx -3.262$$

Now we check that this is a solution (in this case using Gnu-Octave, but a calculator will do...)

>> x=-2*(1+log(2)/log(3))
x = -3.2619
>
>> 3^x*8^(x/(x+2))
ans = 6.0000

Saturday, 21 March 2026

BMO 1993 R1 Q3

I have been working on the following problem from BMO 1993 round 1, question 3, somewhat unsuccessfully ... 

For each positive integer $c$ , the sequence $u_n$ of integers is defined by:

$u_1 = 1 , u_2 = c$, 
$u_n = (2 n +1) u_{n − 1} − ( n^2 − 1) u_{n − 2} , ( n ≥ 3)$. 

For which values of $c$ does this sequence have the property that $u_i$ divides $u_j$ whenever $i ≤ j$ ?

We can start by computing $u_3$ for general $c$, $u_3=7c-8$, then we are interested in values of $c$ which divide $7c-8$, which are $c=1,2,4,8$. We can test these candidates by computing the first few terms of the sequence.

For $c=1$ these are: $1,1,-1,-24,-240,-2280,..$, but $24\not{|}-2280$, so $c=1$ is not a permitted value.

For $c=2$ these are: $1,2,6,24,120,720..$, which all meet the divisibility condition, so we cannot eliminate $c=2$ as a permitted value.

For $c=4$ these are: $1,4,20,120,840,60480,..$, which all meet the divisibility condition, so we cannot eliminate $c=4$ as a permitted value.

For $c=8$ these are: $1,8,48,312,..$, but $48\not{|} 312$, so $c=8$ is not a permitted value.

So we are left with $c=2$ and $c=4$ as possible values.

At this point I thought maybe induction or descent might be up to completing this problem,  but after some effort(days) found I was getting nowhere, so decided to search for some help online. There I found a suggestion that the divisibility condition implies maybe factorials are involved. With this suggestion we recognise that for $c=2$ we have the sequence $1!,2!.3!,4!,5!,6!,...$, and that for $c=4$ we have the off set sequence of factorials divided by $6$. With these "guesses" for the sequences we can employ induction to prove that the required divisibility conditions are satisfied for every term, and so c=2 and c=4 are the values sought.

It would have been nice to have solved this without help, but at least we now know to try factorials when we have such divisibility requirements. I suppose I could have spotted that the sequence for $c=2$ was comprised of factorials, but I did not look at it closely enough.

Wednesday, 4 March 2026

Commentary on the solution of BMO 1993 Q2

 The basic idea behind finding the solution is simple: identify relevant variables, apply any constraints to find any relations between the variables, check boundary/edge cases then use calculus to find the value of the variable/s that minimise the length then use the value to find the minimum length.

Nothing exceptional here, in principle, though there is plenty of room for error in the fairly large amount of algebraic manipulation involved, until we get to the point of having to find real solutions to a quartic. Here we have to be able to spot that this is a special case of a quartic that can be solved without recourse to the quartic "formula".

Learning to spot such "nice" cases is one of the objectives of the training that MO competitors undergo. 

(I should point out that I have not had such training, and the idea of completing the fourth power came to me after several days of contemplation, in my sleep)

Tuesday, 3 March 2026

BMO 1993 Q2

 Q2. A square ABCD of side 1 is divided into two parts by the diagonal AC.

Find the length of the straight line, of minimum length,  that divides triangle ABC into two parts of equal area.

The first thing to do with this problem is to do a sketch and introduce some variables to characterise the approach to a solution. See the sketch below:


Diagram showing the construction and equation corresponding to the specified division of area.







Here I introduce variables \(a\) and \(b\) then the condition that the line cuts the area of the triangle into two equal area pieces gives:

\[A=\frac{a^2}{2}+a(1-a)+\frac{(b-a)(1-a)}{2}=\frac{1}{4}\]

Which may be rearranged to give \(b\) in terms of \(a\):

\[b=\frac{2a-1}{2a-2}\]

The length of the cut \({l}\) satisfies:

\[l^2=(b-a)^2+(1-a)^2\]

Then is we find \(a\) that miinimises \(l^2\) it also minimises \(l\), and this occurs when \(\frac{dl^2}{da}=0\).

After a lot of tedious algebra this gives:

\[\frac{dl^2}{da}=\frac{8a^4-32a^3+48a^2-32a+7}{2a^3-6a^2+6a-2}=0\]

Nowthe denominator is \(2(a-1)^2\) which is never zero on \( (0,1) \) and so can be multiplied out to leave:

\[8a^4-32a^3+48a^2-32a+7=0\]

Now we have the trixy part ... this is a quartic, and even though there is a "formula" for the roots of a quartic (Ferrari/Cardarno method) it is impractical to use in a exam setting (and I don't remember it anyway). But look at the coefficients of the non-constant terms, these are eight times the fourth row of Pascal's triangle, so:

\[8a^4-32a^3+48a^2-32a+7=8(a-1)^4+7-8=0\]

so if \(a\) is real: \((a-1)=\pm \frac{1}{2^{3/4}}\), or \(a=1-\frac{1}{2^{3/4}}\) (as we want the root between \(0\) and \(1\) ).

Then \(b=1-\frac{1}{2^{1/4}}\), and \(l=\sqrt{\sqrt{2}-1}\approx 0.6436\).

Thursday, 5 February 2026

Infinite Internet !??

Quote from YouTube Video https://www.youtube.com/watch?v=YB-JItiQLF4 , "Researchers at MIT looked into it and concluded the amount of high quality data on the internet is finite"

Why did it require "researchers" at a prestigious institution to "look into" anything to discover this? This is akin to saying that Mathematicians have investigated boxes of corn flakes and concluded that most contain a finite number of flakes. Only a moron who did not know the meaning of "finite" and "non-finite" would have ever have thought otherwise (which suggest the quote comes from a press release produced by the public relations department at MIT). 

Wednesday, 4 February 2026

British Mathematical Olympiad 1993, Round 1 Question 1

Continuing with my current practice of finding mathematical problems to solve to keep  my mind occupied, my most recent foray has been a BMO1993-r1 problem:











Here I begin by assigning $B=\sqrt{n}$ and $A$ to be the three most significant digits of $n$. Then playing around we get:

$  n=B^2=1001\times A+1 $

Which suggests we rearrange this (a common manoeuvre for such problems) as:

$ B^2 -1=1001\times A $ 
 
$ (B+1)(B-1)=1001\times A $

Which tells us we want to rearrange the RHS of this last equation as the product of two integers that differ by $2$.  Also we can quickly eliminate the possibilities that the RHS is $1001\times 999$ and $1001\times 1002$ as one is not a square and the other has more than six digits.

That $B^2$ has six digits give constraints on possible values of $B$: $999\ge B \ge 317 $

The prime factorisation of $1001=7\times 11 \times 13$ and two of these factors must be factors of one of terms $(B+1)$ or $(B-1)$ and the remaining factor of the other term, so for some partition(s) $(p_1,p_2,p_3)$ of $(7,11,13)$ we may write:

$ (B+1)(B-1)=(p_1 \times p_2 \times U) \times (p_3 \times V) $

 where the first barracked term on the RHS differs from the second by $\pm 2$.

So lets take $p_1=7$ and $p_2=11$, then we have:

$ (B+1)(B-1)=(77 \times U) \times (13 \times V) $

Then for the $B$s to be in range $U$ is one of $5,6,7,8,9,10,11,12$ and $77$ times these are $385,462 ,539,616,693,770,847,924$.
For a solution we need one or more of these to differ from a multiple of $13$ by $\pm 2$. 
These are approximately $30,36,41,47,53,59,65,71$ $13$s or $390,468,533,611,689,767,845,923$.
We spot that the next to last of these differs from the next to last of the candidate for $U \times 77$ by $2$, and so provides a solution $B=846$, and $n=715716$.

There is no guarantee that this solution is unique, but then the question never asked for all, or a unique solution. Mechanising the heavy lifting give the fill list of solutions for $n$ as: $183184, 328329,528529,715716$.

Wednesday, 28 January 2026

Commentary on blog post on Putnam 1985/B-4

The solution to Putnam 1985/B-4 in another post on this blog illustrates something about real problem solving rather answers in exams/competitions. That is that for a real life problem a lot  of exploration/experimentation is undertaken before a formal solution/proof is developed. In fact for the problem in that other blog post there  was significantly more exploration involved in developing the ideas for a solution than is shown there. Mainly in the form of sketches of particular cases.

When results are published usually none of the exploratory work is mentioned. The solution/proof leaps fully formed like Athena from the head of Zeus. Probably the best known practitioner of extensive exploratory work hidden from the final publish result is Gauss.  

Monday, 26 January 2026

Putnam 1985 B-4 Problem

This is my rewording of question B-4 of the 1985 Putnam competition

A point $P1$, is uniformly sampled from the unit disc, and another $P2$, from the unit circle that is the boundary of the disc. What is the probability that the rectangle $R(P1,P2)$ with sides parallel to the axes and with these two points as opposite vertices  has points outside the disc.

Fig 1. Diagram showing a pair of points and the
rectangle the problem refers to.
















Since we are not sitting in an exam room, nor am I going to look up the solution , and as usual when working on a problem all resources are deployed my first action when faced with a problem like this is to estimate the answer by simulation. That way I will have a check value when a more appropriate answer is found.

The first thing to observe is that if any points of the rectangle defined by $P1$ and $P2$ lie outside the unit disc then one of the other vertices of the rectangle must be outside the disc. This makes the simulation easier to implement as we need only check the other vertices.

The Gnu-Octave (Matlab clone-oid) simulation gives results:
Putnam1
number of replications = 100000
pp = 0.5971
se = 1.5510e-03
Where pp is the probability estimate, and se its standard error.

While we have a simulation available we might as well look at the scatter plot of points $P1$ that produce rectangles with points outside the disc... 

Fig 2. Scatter Plot of points P1 that result in a rectangle
with points outside the disc. The red marker indicates
position of P2 for this case.

















The scatter plot suggests, what if I had been in training for the competition should have been obvious, that given $P2$ the points $P1$ outside the inscribed rectangle with $P2$ as a vertex will produce a rectangle $R(P1,P2)$ with points outside the unit disc.

So if $P2=(x,y)$ the area of the region is $A(P2)=2x\times 2y$. Or if we write $P2=(\cos(\theta),\sin(\theta))$ we get $A(P2)=4\cos(\theta).\sin(\theta)$.

Hence the probability that R(P2) has points outside the unit disc is 

$p(\theta)=(\pi-4 \cos(\theta) \sin(\theta))/ \pi$

Then the probability asked for in the question is:

$P=\frac{\int_0^{\pi/2} p(\theta) d\theta}{\pi/2} $

(the integral here only needs to extend over a quarter of the unit circle due to the symmetries of the geometry.

This integral is more or less text-book stuff, and can be done by using the double angle identity: $\sin(2\theta)=2 \sin(\theta).\cos(\theta)$ or observing that $\frac{d}{d\theta}\sin(\theta)=2 \sin(\theta).\cos(\theta)$.

Either way we find that:
$P= \left(\frac{\pi}{2}-\frac{2}{\pi}\right)/(\pi/2)\approx 0.5947$
The simulation  estimate is less than 2 standard errors from this, so these are sufficiently in agreement for government purposes.