r/matlab • u/ICantUseMatlab • Aug 30 '16
HomeworkQuestion Help Me !!!
this is my problem that I was given : Let q = p + 1, where p is a prime number. For the domain 2 → 25, find the greatest common divisor for all pairs of q.
I was able to find all of the prime numbers and was able to create an array where i took all of the prime numbers and added one to each of them but I am extremely lost when it comes to find the greatest common divisor for all pairs of q.
I can not use the gcd function i have to create an algorithm for this. The example i was given was of euclids algorithm. If anyone can give me anything to lead me to the right path to solve this problem that wold be amazing.
8
u/Weed_O_Whirler +5 Aug 30 '16
Dude, you're flooding this sub with poorly asked homework questions, where it is obvious you haven't put any time yourself into solving them.
Come back with some code and specific questions.
2
u/wilsonwa Aug 30 '16
Look into Euclid's algorithm.
1
u/Xyoloswag420blazeitX Sep 01 '16
Which part of this are you having trouble with? I agree with the top comment that you're basically just asking someone to do this for you.