# Computation Workshop Solution Checker

## Fractions Subtracted Incorrectly

Here is an example of some fractions substracted incorrectly, yet somehow still arrives at the right answer:

$$\frac{8}{2} - \frac{9}{3} = \frac{8 \; - \; 9}{2 \; - \; 3} = \frac{-1}{-1} = 1.$$

We are interested in finding more examples of when this happens. In particular we are looking for positive integers $$a,b,c,d$$ such that $$\frac{a}{b} - \frac{c}{d} = \frac{a-c}{b-d}$$. For any fixed integer $$c$$ let $$S(c)$$ denote the sum of all possible values for $$a$$. For example if $$c=9$$ then the only possiblities for $$a$$ are $$5$$ and $$8$$ (although there are infinitely many possibilities for $$b$$ and $$d$$), and so $$S(9) = 5 + 8 = 13$$.

$$\frac{5}{1} - \frac{9}{3} = \frac{5 - 9}{1 - 3}, \;\;\;\; \frac{8}{2} - \frac{9}{3} = \frac{8 - 9}{2 - 3}, \;\;\;\; \frac{8}{4} - \frac{9}{3} = \frac{8 - 9}{4 - 6}, \;\;\;\; \frac{5}{2} - \frac{9}{6} = \frac{8 - 9}{2 - 6}, \ldots$$

Part A Find $$S(90)$$ Find $$S(9000)$$ Find $$S(12!)$$

## A Spirals Diagonals

Let $$n$$ be a positive integer. The numbers from $$1$$ to $$n^2$$ are arranged into an $$n \times n$$ grid in a spiral pattern, starting from the top-left corner. Let $$D(n)$$ denote the sum of the diagonals of this grid.

Example: If $$n=3$$ then the grid is

 1 2 3 8 9 4 7 6 5

And so $$D(3) = 1+3+5+7+9 = 25$$.

Another Example: If $$n=4$$ then the grid is

 1 2 3 4 12 13 14 5 11 16 15 6 10 9 8 7

And so $$D(4) = 1+4+7+10+13+14+15+16 = 80$$.

Part A Find $$D(12)$$ Find $$D(12345)$$ Find $$D(123456)$$