Arjun Shastry

Ranch Hand

Posts: 1906

1

HS Thomas

Ranch Hand

Posts: 3404

Arjun Shastry

Ranch Hand

Posts: 1906

1

HS Thomas

Ranch Hand

Posts: 3404

posted 13 years ago

A perfect square is a square number . Simply, 1, 4, 9, 16, 25, 36, 49 .....

If you consider the area of a square , I think you can determine the two numbers which add to a perfect square.

a^2 = x^2 + y^2 where x and y are not the sides.

Capablanca , are you sure it's xxyy and not x^2 + y^2 ?

(Just checking before the sum diappears down a black hole.)

regards

[ September 30, 2003: Message edited by: HS Thomas ]

If you consider the area of a square , I think you can determine the two numbers which add to a perfect square.

a^2 = x^2 + y^2 where x and y are not the sides.

Capablanca , are you sure it's xxyy and not x^2 + y^2 ?

(Just checking before the sum diappears down a black hole.)

regards

[ September 30, 2003: Message edited by: HS Thomas ]

Arjun Shastry

Ranch Hand

Posts: 1906

1

Ashok Mash

Ranch Hand

Posts: 1936

posted 13 years ago

Well, there isn't any!

Okay, I cheated , but I was desperate, and still I couldn't find a perfect square between 1000 and 9999 matching above conditon.

There's only one perfect square that follows this pattern, its 7744 and its squareroot is not 74, but its 88!!

Originally posted by Capablanca Kepler:

xxyy is a perfect square.(for e.g.if x=4 y=1, number is 4411)

Well, there isn't any!

Okay, I cheated , but I was desperate, and still I couldn't find a perfect square between 1000 and 9999 matching above conditon.

There's only one perfect square that follows this pattern, its 7744 and its squareroot is not 74, but its 88!!

[ flickr ]

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671

posted 13 years ago

Ummm, that's the answer, Ashok. What condition does it fail to meet?

Without "cheating", I was able to establish that the number could be represented as (121*z*z), where z is an integer such that 4 <= z <= 9. However the only way I found to proceed further was by "trial and error" of the six possible values of z - plug them in to the formula, and see which results in a number of the form xxyy. Which is pretty easy really, but technically "cheating". So now I'm wondering if it's really even possible to find the solution without using

Without "cheating", I was able to establish that the number could be represented as (121*z*z), where z is an integer such that 4 <= z <= 9. However the only way I found to proceed further was by "trial and error" of the six possible values of z - plug them in to the formula, and see which results in a number of the form xxyy. Which is pretty easy really, but technically "cheating". So now I'm wondering if it's really even possible to find the solution without using

*any*"trial and error". Anyone got a better solution?"I'm not back." - Bill Harding, *Twister*

Ashok Mash

Ranch Hand

Posts: 1936

posted 13 years ago

My understanding of the actual question was in lines of the above - that is if that perfectsquare is 7744, according to Capablanca, the root should be xy of xxyy, that is 74. And its not! 7744 is perfect square of 88.

In other words, (xy)*(xy) (where xy is a integer between 10 and 99) should be equal to xxyy. We have xxyy, which is 7744, but its not square of 74, and hence doesnt meet his criteria!

Well, I guess the question was wrong!

[ September 30, 2003: Message edited by: Ashok Mash ]

Originally posted by Ashok Mash:

7744 and its squareroot is not 74, but its 88!!

Originally posted by Capablanca Kepler:

xxyy is a perfect square.(for e.g.if x=4 y=1, number is 4411)

My understanding of the actual question was in lines of the above - that is if that perfectsquare is 7744, according to Capablanca, the root should be xy of xxyy, that is 74. And its not! 7744 is perfect square of 88.

In other words, (xy)*(xy) (where xy is a integer between 10 and 99) should be equal to xxyy. We have xxyy, which is 7744, but its not square of 74, and hence doesnt meet his criteria!

Well, I guess the question was wrong!

[ September 30, 2003: Message edited by: Ashok Mash ]

[ flickr ]

Arjun Shastry

Ranch Hand

Posts: 1906

1

posted 13 years ago

Where did I say that square root follows the pattern xy?Number is in the form xxyy and it is perfect square.Thats the ONLY condition.Answer is 7744 as you obtained.Any number in this form xxyy is divisible by 11 and hence suqareroot should also contain 11.But there are still some trials.Number xxyy can be written as 1100x+11y = 121(10x+y - (10(x+y))/11) that means x+y must be divisible by 11.so possible combinations are 2+9,3+8,4+7,5+6

[ September 30, 2003: Message edited by: Capablanca Kepler ]

[ October 01, 2003: Message edited by: Capablanca Kepler ]

[ September 30, 2003: Message edited by: Capablanca Kepler ]

[ October 01, 2003: Message edited by: Capablanca Kepler ]

MH

Ashok Mash

Ranch Hand

Posts: 1936

posted 13 years ago

Well, I guess I misunderstood the question! But with out the bit that I was looking for (xxyy, x & y patter match), its really easy anyway!

Originally posted by Capablanca Kepler:

Originally posted by Capablanca Kepler:

xxyy is a perfect square.(for e.g.if x=4 y=1, number is 4411)

Well, I guess I misunderstood the question! But with out the bit that I was looking for (xxyy, x & y patter match), its really easy anyway!

[ flickr ]

Vijay S. Rathore

Ranch Hand

Posts: 449

posted 13 years ago

Hi,

the number is 7744.

Here is the code.

public static void perfectSquare() {

int x = 0;

int y = 0;

String number = null;

double sqrt = 0.00;

int iNumber = 0;

for (x = 1; x < 10; x++) {

for (y = 1; y < 10; y++) {

if (x != y) {

number = "" + x + x + y + y;

sqrt = Math.sqrt(Double.parseDouble(number));

iNumber = (int) sqrt;

if (sqrt == iNumber) {

System.out.println(number);

}

}

}

}

}

Vijay

[ October 07, 2003: Message edited by: Vijay Rathore ]

the number is 7744.

Here is the code.

public static void perfectSquare() {

int x = 0;

int y = 0;

String number = null;

double sqrt = 0.00;

int iNumber = 0;

for (x = 1; x < 10; x++) {

for (y = 1; y < 10; y++) {

if (x != y) {

number = "" + x + x + y + y;

sqrt = Math.sqrt(Double.parseDouble(number));

iNumber = (int) sqrt;

if (sqrt == iNumber) {

System.out.println(number);

}

}

}

}

}

Vijay

[ October 07, 2003: Message edited by: Vijay Rathore ]

SCJP, SCJD, SCWCD1.4, IBM486, IBM484, IBM 483, IBM 287, IBM141, IBM Certified Enterprise Developer - WebSphere Studio, V5.0

Author of IBM 287 Simulator Exam