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)