Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #275: Greatest Common Denominator

ahsanaali
11 - Bolide
Spoiler
ahsanaali_0-1665724485658.png

 

peter_gb
9 - Comet

I brute forced this one, would like to come back and use the iterative approach to properly construct the Euclid's algorithm method as outlined here https://www.cuemath.com/numbers/greatest-common-divisor-gcd/  but will have to revisit when I have more time :)

 

Spoiler
challenge_275_pgb.png

DataNath
17 - Castor

My solution to #275.

 

Spoiler
DataNath_0-1667644464641.png
NikkiJain
7 - Meteor
Spoiler
Spoiler 


NikkiJain_0-1668601299696.png

 

I have used Python to solve this.

 

This is the Python code, I am using:

 

from ayx import Alteryx

import pandas as pd
import math
data = Alteryx.read("#1")
df = pd.DataFrame(data, columns=['Material', 'Volume'])

 

def findgcd(x, y):
while(y):
x, y = y, x % y
return x

l = df.Volume.values
num1=l[0]
num2=l[1]
gcd=findgcd(num1,num2)

for i in range(2,len(l)):
gcd=findgcd(gcd,l[i])


result = gcd

output = pd.DataFrame([gcd], columns = ['Material A'])

Alteryx.write(output,1)

FrederikE
13 - Pulsar
Spoiler
FrederikE_0-1668788530195.png

 

ZacharyRyanTIL
8 - Asteroid

solved

gerda
8 - Asteroid
Spoiler
challenge 275.png

Here's the solution!

RWvanLeeuwen
11 - Bolide

I wonder if my solution is sufficiently robust, but I think it would

Spoiler
for each material: get the distinct volumes and compare it with the highest; use that fraction and get the lowest value so we only look at the increment size and use that as the GCDfor each material: get the distinct volumes and compare it with the highest; use that fraction and get the lowest value so we only look at the increment size and use that as the GCD

the silliest thing happened though because the summarize tool produces a value that is not the minimum in the set...

SkomantasTamulaitis
8 - Asteroid

Here's my solution.

Spoiler
Screenshot 2022-11-30 161527.png
ARussell34
8 - Asteroid

Needed a refresher and to make sure to group by the materials, but found 840 and 9,360 were the greatest common denominators.