Algebra or Computer Science?

Given that z + 1 z = 2018 z+\frac{1}{z}=2018 ; after how many digits does 2018 2018 occur in z 2048 + 1 z 2048 z^{2048}+\frac{1}{z^{2048}} ?

Clarification: In the number 2805 2018 431381, 2018 2018 occurs after 4 4 digits.


Inspired from the following problem; I Love Algebra by Sirajum Prince .


The answer is 4313.

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

Zeeshan Ali
May 27, 2018

Let's generalize x n + 1 x n x^n+\frac{1}{x^n} when x + 1 x = a x+\frac{1}{x}=a and n n is a power of 2 2 as follows;

x + 1 x = a x+\frac{1}{x}=a , where n = 1 n=1 .

x 2 + 1 x 2 = ( x + 1 x ) 2 2 = a 2 2 x^2+\frac{1}{x^2}=\left( x+\frac{1}{x} \right)^2-2=a^2-2 , where n = 2 n=2 .

x 4 + 1 x 4 = ( x 2 + 1 x 2 ) 2 2 = ( a 2 2 ) 2 2 x^4+\frac{1}{x^4}=\left( x^2+\frac{1}{x^2} \right)^2-2=\left( a^2-2 \right)^2-2 , where n = 4 n=4 .

x 8 + 1 x 8 = ( x 4 + 1 x 4 ) 2 2 = ( ( a 2 2 ) 2 2 ) 2 2 x^8+\frac{1}{x^8}=\left( x^4+\frac{1}{x^4} \right)^2-2=\left( \left( a^2-2 \right)^2-2 \right)^2-2 , where n = 8 n=8 .

\vdots

x n + 1 x n = ( x n 2 + 1 x n 2 ) 2 2 x^n+\frac{1}{x^n}=\left( x^{\frac{n}{2}}+\frac{1}{x^{\frac{n}{2}}} \right)^2-2 , where n = 2 m n=2^m and m > 0 m>0 .

Therefore;

x n + 1 x n = { a if n = 1 ( x n 2 + 1 x n 2 ) 2 2 if n = 2 m , m 1. x^n+\frac{1}{x^n} = \left\{ \begin{array}{ll} a & &\text{if } n = 1\\ {\left( x^{\frac{n}{2}}+\frac{1}{x^{\frac{n}{2}}} \right)}^2-2 & &\text{if } n=2^m, m \ge 1. \end{array} \right.

We can simply write a recursive function in any programing language, say Python3, as follows;

1
2
3
4
def f(n, a):
    if n == 1:
        return a
    return (f(n//2, a)**2-2)

  • In the question, n = 2048 n=2048 and a = 2018 a=2018 ; simply call f(2048, 2018) . The result is a long number, and 2018 2018 occurs at 431 3 t h 4313^{th} position.
David Holcer
Jul 31, 2018
1
2
3
4
c=2018
for i in range(11):
    c=(c**2)-2
print(str(c).index('2018'))

Is there a way to solve this without using a computer programme.

Srikanth Tupurani - 2 years, 7 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...