Year's Beginning

X 2 = 2017... X^2 = 2017... Find the smallest positive integer X X such that the first 4 digits of X 2 X^2 are 2017.


The answer is 4492.

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.

5 solutions

Ravneet Singh
Apr 23, 2017

For X 2 X^2 to have starting digits of 2017. This simply means that 2017 × 1 0 n X 2 < 2018 × 1 0 n 2017 \times 10^n \leq X^2 < 2018 \times 10^n

Now before taking square roots on both sides, we have to check that whether n n is odd or even.

Considering both the cases:

n odd: 142.021125189 × 1 0 k X < 142.056326857 × 1 0 k n \text{ odd: } 142.021125189 \ldots \times 10^k \leq X < 142.056326857 \ldots \times 10^k

n even: 44.9110231458 × 1 0 k X < 44.9221548904 × 1 0 k n \text{ even: } 44.9110231458 \ldots \times 10^k \leq X < 44.9221548904\ldots \times 10^k

When n n is odd, as we vary k k , the smallest integer X X will be 14203.

When n n is even, as we vary k k , the smallest integer X X will be 4492 \boxed {4492} .

A lot of guess and checking makes programming a reasonable solution (java code)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class Main {
public static void main(String[] args) {
int i = 44; //starting from sqrt(2017)
boolean solved = false;
while(solved == false){
   i++;
   int value = i*i;
   if(Integer.toString(value).substring(0,4).equals("2017")){
     solved = true;
   }
}
System.out.println(i);}} 

Alex Li - 4 years, 1 month ago

Log in to reply

Wow!! Nice coding..

Ojasee Duble - 4 years, 1 month ago

I think this question can also be done by traditional method of finding square roots

Kunal Kundwani - 4 years ago
Laurent Shorts
Apr 23, 2017

2017 \sqrt{2017} is not an integer, so it cannot be X 2 X^2 .

20170 0 < X < 20180 0 \sqrt{20170\cdots0}<X<\sqrt{20180\cdots0} , for the same number of trailing 0's:

142 < 20 , 170 < X < 20 , 180 < 143 142<\sqrt{20,170}<X<\sqrt{20,180}<143 , not possible.

449 < 201 , 700 < X < 201 , 800 < 450 449<\sqrt{201,700}<X<\sqrt{201,800}<450 , not possible.

1420 < 2 , 017 , 000 < X < 2 , 018 , 000 < 1421 1420<\sqrt{2,017,000}<X<\sqrt{2,018,000}<1421 , not possible.

20 , 170 , 000 < 4492 X 4492 < 20 , 180 , 000 \sqrt{20,170,000}<4492\leq X\leq4492<\sqrt{20,180,000} , possible for X = 4492 X=4492 .

Oh this is much clearer than the other solutions because we don't need to know the square roots of 2017 and 2018.

This is my favorite. Thanks for sharing!

Pi Han Goh - 4 years, 1 month ago

This is a good solution but isn't justified very well. Who says the digits that follow 2017 must be 0's? Why can't we consider 201,798?

Jordan Baillie - 4 years, 1 month ago

Log in to reply

We consider every number between 201,700 and 201,800, therefore 201,798 is included.

Laurent Shorts - 4 years ago
Tom Karasmanis
Apr 26, 2017

The square root of 2017 is 44.9... which is not an integer.

The next possible answer is the smallest positive integer of the square roots of 2017n (5 digits) where n is 0-9. We could try all 10 values in ascending order and stop if we find a positive integer, but there is a faster approach. In order for X^2 to be within 2017n (let's call that the "solution range"), X must be must be between the square roots of 20170 and 20179, i.e. there must be a positive integer between the square roots of 20170 and 20179. In order for this to be true, the integer portion of the square root of 20179 must be strictly larger than the integer portion of the square root of 20170. If not, we will keep adding a digit until there is a positive integer between the square roots of the smallest and largest numbers in the solution range .

For 2017n:

  • square root of 20170 = 142.02...
  • square root of 20179 = 142.05...

There is no positive integer between 142.02... and 142.05...

For 2107nn:

  • square root of 201700 = 449.11...
  • square root of 201799 = 449.22...

There is no positive integer between 449.11... and 449.22...

For 2107nnn:

  • square root of 2017000 = 1420.21...
  • square root of 2017999 = 1420.56...

There is no positive integer between 1420.21... and 1420.56...

For 2107nnnn:

  • square root of 20170000 = 4491.10...
  • square root of 20179999 = 4492.21...

There is one positive integer between 4491.10... and 4492.21... and it is 4492 .

If there were more than one positive integer in the range, we would just choose the smaller of the two.

wolframalpha

solve over the integers x^2=20170000+y, 0<y<=9

result

4491.1<Re(x)<4492.22

meaning x=4492

Harout G. Vartanian - 4 years, 1 month ago

Log in to reply

correction y<=9999

Harout G. Vartanian - 4 years, 1 month ago

nice solution!

Inksa Inkeroinen - 3 years, 1 month ago
Rajdeep Brahma
Apr 26, 2017

Note that 44^2=1936,45^2=2025.So we must go to 440.(Since we can't get into fractions,hence we increase 1 place of decimal).440^2=193600,449^2=201601(2016...so close!!),but 450^2=202500,we now move to 4491^2=20179081,4492^2=20178064=2017....& job is done. :)

You're skipping over the possibility that the solution X^2 = 2017* has an odd number of digits.

Richard Desper - 4 years, 1 month ago

I didn't quite get it....can you pls explain further??

rajdeep brahma - 4 years, 1 month ago
James Cheal
Apr 28, 2017

long x = 1;

long y;

void setup() {

Serial.begin(9600);

}

void loop() {

y = pow(x, 2);

Serial.println(y);

while (y >= 10000) {

y = y / 10;

}

if (y == 2017) {

Serial.print("The value of x is: ");

Serial.print(x);

while (1) {

}

}

x++;

}

The code above gives the value of x in a couple of seconds.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 24 14:17:03 2017

@author: Fitzgeralds
"""

#https://brilliant.org/weekly-problems/2017-04-24/advanced/

# Find the smallest positive integer X such that the first 4 digits of are 2017.

starts_with = 2017
y = len(str(starts_with))

i = 1
while i > 0:
    i += 1
    k = i**2
    if int(str(k)[:y]) == starts_with:
        print i, k
        break

1
4492        20178064

Michael Fitzgerald - 3 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...