I have a question. I can’t wrap my head around it. It is suppose to be done on Mathematica.

We have a sequence formula x^2+y^2 Where x is positive and y is greater than once. There is a different sequence for each value of y from 1 to 100. For the first 10,000 terms of the sequence((for a given y), we need to find the gcd of the two consecutive terms of the sequence.

Then I’m suppose to make aa list with the max value for the GCD for each of the 100 sequences

this is what i did so far. I did GCD[a, a+1] so I can get the consecutive elements from the list, but how do I make it continue down the list? Thank you!

    f = x^2 + y^2
l1 = f /. y -> Range[1, 100];
l2 = GCD[l1 /. x -> Range[1, 10000]];
a = Simplify[list2]
GCD[a,a+1]


When y is fixed,for example y=50 we get the result as below.

Clear["*"];
f = x^2 + y^2;
y = 50;
GCD @@@ Partition[f /. x -> Range[10000], 2,1]
%// Counts

<|1 -> 9790, 73 -> 136, 137 -> 72, 10001 -> 1|>

(* when x,y range from 1 to 10 *)
Clear["*"];
f = x^2 + y^2;
(GCD @@@ Partition[f /. x -> Range[10], 2,1] /. y -> Range[10])

• what does the 2 mean in Range[10], 2]?''thank you for help!
– Aran
Commented Sep 29, 2020 at 2:00
• @Aran Sorry! We should use Partition[#,2,1], instead of Partition[#,2] for example, Partition[{a, b, c, d}, 2, 1] get {{a, b}, {b, c}, {c, d}} Commented Sep 29, 2020 at 2:03
• thank you so much!
– Aran
Commented Sep 29, 2020 at 2:16
• [f /. x -> Range[10000], 2, 1] what is the 2 and 1 for? thanks again!
– Aran
Commented Sep 29, 2020 at 2:29
• Partition[f /. x -> Range[10], 2, 1] means that list = f /. x -> Range[10]; Partition[list, 2, 1] . They are equivalent. 2 and 1 is the variables of Partition Commented Sep 29, 2020 at 2:38