Posts

Showing posts from 2020

Magic Triangle - Solution

Image
I first saw this Magic Triangle puzzle in  CSIRO ’s  Double Helix   here : You are given a triangle with circle on each point and on each side: Magic Triangle Then, using the numbers from 1 to 6, arrange them in a triangle with three numbers on each side. Swap them around until the sides all add up to the same number. Finally, sum each side to 10. Method Let’s label the triangle: starting from any vertex label the nodes: Labelled Magic Triangle The method to solve this problem is broken into the following steps: get all permutations of numbers 1 to 6 as a, b, c, d, e, f filter permutation to satisfy conditions: a + b + c == c + d + e == e + f + a and final condition:  a + b +c == 10 Using Haskell All permutations of numbers 1 to 6: import Data.List permutations [ 1 .. 6 ] This will give  6! = 720  permutations. Filter on sides summing up to the same value: [ [(a,b,c), (c,d,e), (e,f,a)] | [a,b,c,d,e,f] <- permutations [ 1 .. 6 ], a + b + c ==...

Viral Maths Problems

Image
Each year we are treated to another viral maths problem. Can you solve (insert bad equation here)? The answer is rarely given, and the equation is poorly structured. So, lets unpack one such problem and explain why I believe they are so badly formed. Example The last one I saw online was the challenge: Can you solve? 8 ÷ 2(2+2) My first observation is the unusual use of ÷ (mathematicians prefer / ) and bad bracketing. Let us clean up the expression to clear up some ambiguity: 8 ÷ 2 × (2+2) This makes it much easier to the next step of applying BODMAS . The order of operations here are: Solve the Brackets, then From left to right apply division's and multiplications From left to right apply addition's and subtraction's Here: division and multiplication have equal precedence as do addition and subtraction. Applying these operations gives: 8 ÷ 2(2+2) =  8 ÷ 2 × (2 + 2)                  =    8...

Git Pipelines

Image
Git has become the  de facto  standard for version control. This has given rise to many vendors hosting Git repositories. Each vendor provides Git functionality such as branching, pull requests, project membership. Now there is growing competition to provide Continuous Integration / Continuous Delivery (CI/CD) services. It has become a very competitive market. One feature that extends version control beyond just hosting source repositories, is pipelines. Pipelines are an extensible suite of tools to build, test and deploy source code. Even data hosting sites like  Kaggle  now support  pipelines . This article provides a brief summary of some pipeline features from three popular Git hosting sites:  GitLab ,  Bitbucket  and  GitHub . This article was written in GitLab flavoured Markdown, and rendered to HTML using  pandoc . This provides a version controlled project that can be used to show features for each Git repository. The fea...