How good is your arithmetic modulo 2017?

Let B 0 = 6 , B 1 = 1 , B_0 = 6, B_1 = -1, and B 2 = 17 B_2 = 17 . Define a sequence of integers B n B_n as follows:

B n + 1 = 3 B n 4 B n 2 B_{n+1} = 3B_n-4B_{n-2}

What is the residue of n = 1 2018 B n \sum_{n=1}^{2018}B_n modulo 2017?


The answer is 8.

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.

2 solutions

Will van Noordt
Dec 31, 2017

One solution is to find a general form for B n B_n :

We have the characteristic polynomial for B n B_n as x 3 3 x 2 + 4 = 0 x^3-3x^2+4=0 .

We may try a few integers as roots and find that x = 1 x = -1 is a root. We reduce the polynomial to a quadratic via long division:

x 3 3 x 2 + 4 = ( x + 1 ) x 3 3 x 2 + 4 x + 1 = ( x + 1 ) x 3 + x 2 4 x 2 4 x + 4 x + 4 x + 1 x^3-3x^2+4 = (x+1)\frac{x^3-3x^2+4}{x+1} = (x+1)\frac{x^3+x^2-4x^2 - 4x + 4x + 4}{x+1}

= ( x + 1 ) ( x 3 + x 2 x + 1 4 x 2 + 4 x x + 1 + 4 x + 4 x + 1 ) = ( x + 1 ) ( x 2 4 x + 4 ) = ( x + 1 ) ( x 2 ) 2 = (x+1)\Bigg(\frac{x^3+x^2}{x+1} - \frac{4x^2+4x}{x+1} + \frac{4x+4}{x+1}\Bigg) = (x+1)(x^2-4x+4) = (x+1)(x-2)^2

Due to the nature of the characteristic polynomial, this implies that

B n = a 2 n + b n 2 n + c ( 1 ) n B_n = a2^n+bn2^n+c(-1)^n for some constants a , b , c a, b, c . We are given initial values for B n B_n , so we substitute:

a 2 0 + b ( 0 ) 2 0 + c ( 1 ) 0 = a + c = 6 a2^0+b(0)2^0+c(-1)^0 = a + c = 6

a 2 1 + b ( 1 ) 2 1 + c ( 1 ) 1 = 2 a + 2 b c = 1 a2^1+b(1)2^1+c(-1)^1 = 2a+2b-c = -1

a 2 2 + b ( 2 ) 2 2 + c ( 1 ) 2 = 4 a + 8 b + c = 17 a2^2+b(2)2^2+c(-1)^2 = 4a+8b + c = 17

Solving yields a = b = 1 a = b = 1 and c = 5 c = 5 . So, the general form of B n B_n is given by

B n = ( n + 1 ) 2 n + 5 ( 1 ) n B_n = (n+1)2^n+5(-1)^n

Now, we consider n = 1 2018 B n \sum_{n = 1}^{2018} B_n :

n = 1 2018 = n = 1 2018 2 n + n 2 n + 5 ( 1 ) n = n = 1 2018 2 n + n = 1 2018 n 2 n + n = 1 2018 5 ( 1 ) n \sum_{n = 1}^{2018} = \sum_{n = 1}^{2018}2^n+n2^n+5(-1)^n = \sum_{n = 1}^{2018}2^n+\sum_{n = 1}^{2018}n2^n+\sum_{n = 1}^{2018}5(-1)^n

Note that because 2018 is even, the third term is zero, leaving

n = 1 2018 B n = n = 1 2018 2 n + n = 1 2018 n 2 n \sum_{n = 1}^{2018}B_n = \sum_{n = 1}^{2018}2^n+\sum_{n = 1}^{2018}n2^n

Recall that, if x 1 x\neq 1 , then

n = 1 q 2 n = 2 ( 2 q 1 ) \sum_{n = 1}^{q}2^n = 2(2^q-1)

and (as it can be shown with some simple calculus):

n = 1 q n 2 n = ( q 1 ) 2 q + 1 + 2 \sum_{n = 1}^{q}n2^n = (q-1)2^{q+1} + 2

So,

n = 1 2018 B n = n = 1 2018 2 n + n = 1 2018 n 2 n \sum_{n = 1}^{2018}B_n = \sum_{n = 1}^{2018}2^n+\sum_{n = 1}^{2018}n2^n

= 2 2 2018 1 + ( 2017 ) 2 2019 + 2 = 2 2019 2 + ( 2017 ) 2 2019 + 2 = ( 2018 ) 2 2019 =2\frac{2^{2018}-1} + (2017)2^{2019} + 2 = 2^{2019} - 2 + (2017)2^{2019}+2 = (2018)2^{2019}

We now have that

n = 1 2018 B n ( 2018 ) 2 2019 2 2019 m o d 2017 \sum_{n = 1}^{2018}B_n\equiv (2018)2^{2019} \equiv 2^{2019} \mod 2017

Since 2017 is prime, we can invoke Fermat's little theorem:

2 2019 2 2017 1 2 3 1 2 3 8 m o d 2017 2^{2019} \equiv 2^{2017-1}2^3 \equiv 1\cdot 2^3 \equiv 8 \mod 2017

Therefore, if B n B_n is defined as above, then

n = 1 2018 B n 8 m o d 2017 \sum_{n = 1}^{2018}B_n \equiv 8 \mod 2017

Liam Newsom
Dec 31, 2017

Fun problem. I simply ran the following C# code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
            int bn, bnm1, bnm2;
            int bnp1 = 0;
            bnm2 = 6;
            bnm1 = -1;
            bn = 17;
            int count = 3;
            int acc = bnm1+bn;
            while (count-1 != 2018)
            { 
                bnp1 = (3 * (bn) - 4 * (bnm2)) % 2017;
                if (bnp1 < 0) { bnp1 += 2017; }
                bnm2 = bnm1;
                bnm1 = bn;
                bn = bnp1;
                acc += bnp1;
                acc %= 2017;
                count++;
            }
            Console.WriteLine(acc);

The output of this code was 8 .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...