Posts

Showing posts from 2020

Magic Triangle - Solved

Image
Magic Triangles This puzzle features in  CSIRO ’s  Double Helix  blog post,  A Magic Triangle Brainteaser . The  Magic Triangle  problem involves arranging integers on a triangle. Consider a triangle with a circle at each vertex and along each side: Magic Triangle Arrange the numbers 1 to 6 in the circles so that each side sums to the same value. This specific challenge requires each side to sum to 10. Method for Triangles First, label the nodes sequentially starting from any vertex: Labelled Magic Triangle The solution involves the following steps: Generate all permutations of numbers 1 to 6 as  a ,  b ,  c ,  d ,  e ,  f . Filter permutations to satisfy the magic shape condition:  a  +  b  +  c  =  c  +  d  +  e  =  e  +  f  +  a . Apply the final condition:  a  +  b  +  c  = 10 . Using Haskell Generate all permutations of the numbers 1 to 6: import Data.List permutations [ 1 .. 6 ] This yields  6! = 720  permutations. Filter f...

Viral Maths Problems

Image
Every year, we see a fresh wave of 'viral' maths problems. You know the ones: 'Can you solve this?' The catch is, they rarely give you the answer, and the equations are usually a mess. Let's unpack one of these problems to see why they’re so confusing—and how we can actually fix them. 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  (US refers to this as PEDMAS ) . 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...

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...