BLOG
-
Cayley problem 23, 1997
January 22, 2020
Given the set , how many integers cannot be written as the sum of exactly two different elements of ?
The numbers in are Fibonacci numbers, so we may guess that some magic is involved here. Indeed, we vaguely remember something about numbers having unique representations as sums of Fibonacci numbers. If the sum of any two Fibonacci numbers is a unique integer, the job of counting possibilities would be a lot simpler. Perhaps we can prove this. Here are the first 10 Fibonacci numbers:
1 2 3 4 5 6 7 8 9 10 1 1 2 3 5 8 13 21 34 55 Set contains to . Notice that is not included in . We want to prove that the sum of any two different Fibonacci numbers and with is unique.
Let . There are two situations to think about. First, if then
by definition of Fibonacci numbers. And if it is clear that
Either way, .
Suppose the same number can be written as the sum of two different Fibonacci numbers in two different ways:
There is no loss if we suppose and . Since , we have
And since , we have
Since is sandwiched between two consecutive Fibonacci numbers, it must be that and . For Fibonacci numbers greater than , these imply and .
Now we can count. Imagine all the possible sums of two elements of organized into a table. We remove the sums of the form : this amounts to removing the diagonal which has 9 element. Then we divide by two to remove one of the upper or lower triangles of the table, because we don’t want to count both and . This leaves
There are 36 integers expressible as the sum of two elements of . Smallest is 3, largest is 89. In the range there are numbers. The total number of integers not expressible is therefore 87 - 36 = 51.
Let’s check this by Racket programming.
First we create a list of all the numbers expressible as the sum of two different elements of . We use a nested for-loop with a when-clause to catch the cases we are interested in.
(define cayley-23-list (list 1 2 3 5 8 13 21 34 55)) (define expressibles (for*/list ((Fm cayley-23-list) (Fn cayley-23-list) #:when (> Fm Fn)) (+ Fm Fn)))
And then we filter the range of numbers from 3 to 89, keeping only the ones that are not in the expressible list. Getting the length of this filtered range solves the problem.
(define (solve-cayley-23) (length (filter (lambda (n) (not (member n expressibles))) (range 3 90))))
Run it in the Racket interactive REPL
> (solve-cayley-23) 51
There we go!
-
Cayley problem 21, 1997
January 14, 2020
From the Cayley competition, 1997. Consider the equation
with the constraint Find all solutions among the natural numbers.
If we set and do a bit of algebra, the variable vanishes and we are left with Organizing the possible values of , and into a table, we get something like…
11 1 1 11 1 2 11 1 27 22 2 1 If you have good bookkeeping skills, finish the whole table. You should get 42 rows! So there are 42 possible solutions.
But let’s verify this with a little computer programming. Define a predicate that is true when the given conditions of the problem are true:
#lang racket (define (cayley-21-conditions? a b c) (and (= (/ (+ (/ a c) (/ a b) 1) (+ (/ b a) (/ b c) 1)) 11) (<= (+ a (* 2 b) c) 40)))
Then loop through all the possibilities for , and from 1 to 40 and collect them into a giant list of triples . Then we filter this list by applying the
cayley-21-conditions?
predicate to each one. Those that pass are kept, those that are false are filtered out.(define (abc-filter max-a max-b max-c predicate) (filter (lambda (args) (apply predicate args)) (for*/list ((a (range 1 (+ max-a 1))) (b (range 1 (+ max-b 1))) (c (range 1 (+ max-c 1)))) (list a b c))))
Running
> (abc-filter 40 40 40 cayley-21-conditions?)
Yields a list of solutions. Then calling
length
on this list gives the total number of solutions: 42.How many solutions would there be if the second condition was ?