Spiral table 2021

Computer Science Level pending

The Table is formed, using the spiral notation of integers (see figure). The sum of S ( n ) S(n) numbers in yellow cells for each n n is calculated. Find the minimum value of n at which the sum S ( n ) S(n) is divisible by 2021 2021 .

S ( 1 ) = 1 , S ( 2 ) = 13 , . . . , S ( 9 ) = 10821 , . . . . S(1)=1, S(2)=13,..., S(9)=10821,....

Give answer n n .


The answer is 774.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Pi Han Goh
Jan 4, 2021

I don't think this can be solved by hand alone. This reminds me of Ulam's spiral .

Looking at the numbers formed from the right diagonal 1 , 3 , 13 , 31 , 1,3,13,31, \ldots tells us that it follows the sequence { a n } n 1 = 4 n 2 10 n + 7 \{a_n \}_{n\geqslant1} = 4n^2 - 10n + 7 .

Looking at the numbers formed from the left diagonal 1 , 5 , 17 , 37 , 65 , 1,5,17,37,65, \ldots tells us that it follows the sequence { b n } n 1 = 4 ( n 1 ) 2 + 1 \{b_n \}_{n\geqslant1} = 4(n-1)^2 + 1 .

I'll leave the proof of these sequences as an exercise for the readers.

Thus, the n th n^\text{th} row consists of N = 2 n 1 N=2n-1 integers, 4 ( n 1 ) 2 + 1 , 4 ( n 1 ) 2 , 4 ( n 1 ) 2 1 , , 4 n 2 10 n + 7 4(n-1)^2 + 1, \quad 4(n-1)^2 , \quad4(n-1)^2 - 1, \quad\ldots \quad , \quad4n^2 - 10 n+ 7

which follows an arithmetic progression , and the sum of each row is N 2 [ 2 a + ( N 1 ) d ] = 2 n 1 2 [ 2 [ 4 ( n 1 ) 2 + 1 ] + ( 2 n 2 ) ( 1 ) ] = ( 2 n 1 ) ( 4 n 2 9 n + 6 ) \dfrac N2 \Big[ 2a + (N-1)d \Big] = \dfrac{2n-1}2 \Bigg [ 2\Big[ 4(n-1)^2 + 1 \Big] + (2n-2)(-1) \Bigg ] = (2n-1)(4n^2-9n + 6)

Hence, S ( n ) = k = 1 n ( 2 k 1 ) ( 4 k 2 9 k + 6 ) = n 6 ( 12 n 3 20 n 2 + 9 n + 5 ) S(n) = \sum_{k=1}^n (2k-1)(4k^2-9k + 6) = \dfrac n6(12n^3 - 20n^2 + 9n + 5)

by invoking sum of powers . We want to find min ( n ) \min(n) such that S ( n ) S(n) is divisible by 2021.

Running a simple script tells us that the answer is 774 \boxed{774} . I'm interested to see a non-computer assisted solution.

1
2
3
4
5
6
7
8
9
n = 1
while True:
    if n * (12 * (n**3) - 20 * (n**2) + 9 * n + 5)/6 % 2021 == 0:
        print(n)
        break
    else:
        n += 1

# Output: 774

Thank for attention. Fine solution. There is interpolation polynomial for S(n) with power 4 - Wolframalpha . Happy New Year!

Yuriy Kazakov - 5 months, 1 week ago

I had basically the same solution, except I looked first at the central column of numbers 1 , 4 , 15 , 34 , 1,4,15,34,\ldots ; these have the form 4 n 2 9 n + 6 4n^2-9n+6 . This will be the average value of the 2 n 1 2n-1 numbers in the n th n^\text{th} row, so the row total is ( 2 n 1 ) ( 4 n 2 9 n + 6 ) (2n-1) \left(4n^2-9n+6\right) .

This doesn't help much with the final part of the question, which I did the same way. It's slightly quicker to factorise first, 2021 = 43 × 47 2021=43\times 47 (remember that fact, I bet it'll come up a lot this year!), then use the Chinese remainder theorem, but I still couldn't see a way to solve it by hand.

Chris Lewis - 5 months, 1 week ago

Log in to reply

Thanks for attention. I write problem for #ComputeSience, but @brilliant change to #Probability.

Yuriy Kazakov - 5 months, 1 week ago

Log in to reply

I've changed the topic for you.

Pi Han Goh - 5 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...