The first three terms of sequence {C(n)} are 1440, 1716 and 1848. These are obtained by multiplying the corresponding terms of two arithmetic sequences:{A(n)} and {B(n)}.
Find the 8th term of {C(n)}
C(8) = 348
At first I looked at combinations of prime factors but ultimately settled on a brute force type approach.
I came up with 12 possible solutions, but really only 6 (the other 6 just being A and B switched). I looked at every possible factor of first integer paired with every possible factor of the second integer and kept only those pairings which resulted in an arithmetic series where the next term was also a factor of the third integer.
But by coincidence, or design, all gave the same answer for C(8): 348
---- Python code follows ----
def divisors(n):
""" input integer, output list of lists of divisors of n """
divisors = []
for i in range(2,int(n/2)+2):
if (n/i)%1 != 0:
continue
divisors.append(i)
return divisors
d1440=divisors(1440)
d1716=divisors(1716)
d1848=divisors(1848)
print('a1,b1,a2,b2,a3,b3,a8,b8, a8*b8')
for a1 in d1440:
b1 = int(1440/a1)
for a2 in d1716:
b2 = int(1716/a2)
a3 = 2*a2 - a1
if a3 not in d1848:
continue
b3 = 2*b2 - b1
if b3 not in d1848:
continue
if a3*b3 != 1848:
continue
a8 = (a1 + 7*(a2-a1))
b8 = (b1 + 7*(b2-b1))
print(a1,b1,a2,b2,a3,b3,a8,b8, a8*b8)
print('The answer is: ', a8*b8)
---- output ----
a1,b1,a2,b2,a3,b3,a8,b8, a8*b8
8 180 11 156 14 132 29 12 348
15 96 13 132 11 168 1 348 348
16 90 22 78 28 66 58 6 348
24 60 33 52 42 44 87 4 348
30 48 26 66 22 84 2 174 348
32 45 44 39 56 33 116 3 348
45 32 39 44 33 56 3 116 348
48 30 66 26 84 22 174 2 348
60 24 52 33 44 42 4 87 348
90 16 78 22 66 28 6 58 348
96 15 132 13 168 11 348 1 348
180 8 156 11 132 14 12 29 348
The answer is: 348
|
Posted by Larry
on 2021-03-17 13:00:36 |