Skip to main content

Posts

Showing posts from June, 2022

Friday Quiz maths question, 24 Jun 2022, a day late.

  There is just one pair of numbers (x,y)   where  when you add them together, mult iply them t ogether or divide x by y , the answers are all equal .   What are those numbers ? If you'd like to have a go at finding the answer, please do, and I'd love to hear how you did it. Below are my thoughts, experiments and answer. I should have found the answer sooner than I did.  First of all I used BASIC, set up a couple of loops for x and y and tested for meeting the conditions. That didn't produce an answer and so I did try smaller steps and included negative numbers. I now know that I should have found the answer then but for some reason my program didn't produce the result.  Wanting to at least find the ballpark , I thought about ways to plot these three conditions on a graph. A 2d graph wouldn't really do it because we want to test all values of x and y. I tried using some 3d graphing systems to plot z=x+y, z=x*y and z=x/y,  to see where they all intersected.  But it w

Friday quiz problem 10 Jun, an exercise in the mod function

T oday's Friday Quiz question seems to have been devised as an exercise in writing a computer program using the mod() function: A pl a toon of soldiers is lining up for a parade.   When they line up in rows of 3, one soldier is left over.  When they line up in rows of 4,  two soldiers are left over.  When they line up in rows of 5,  three soldiers are left over.  When they line up in rows of 6, four soldiers are left over.  However, they can line up in rows of  7  with no-one left over.  What is the smallest possible number o f soldiers in the platoon ? Spoiler alert: my answer is in the video. But writing the program is the fun part for me, not coming up with the answer. As I say in the video, any language should have the mod() function. If not, you can write your own function / routine / word ,  it's the remainder after dividing one number by another.  Which is basically what the question is asking for. The lowest number where n mod 3 = 1, n mod 4 = 2 etc. Here's my progr