Can You Name this Number?

A student carelessly wrote a four digit number, a b c a abca , on a piece of paper, instead of writing a b × c a a^b \times c^a . It so happened that the two figures had the same value. What was the 4 digit number a b c a abca ?

Details and Assumptions
a, b, and c are digits.


The answer is 2592.

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.

9 solutions

Shreyash S
Aug 28, 2014

I used Python code

for a in xrange(10):
    for b in xrange(10):
        for c in xrange(10):
            if((a**b)*(c**a) == (1000*a+100*b+10*c+a)):
                print a, b, c, a

Output

2 5 9 2

why did you us python (im not familiar with it)can u explain a little more briefly?

Ankit Vijay - 6 years, 9 months ago

I feel the program below will greatly reduce the time.

for a in xrange(10):

  b=9

  c=9

  if((a**b)*(c**a) < (1000*a+100*b+10*c+a)):

       return  

  for b in range(9,1,-1):

       c=9

       if((a**b)*(c**a) == (1000*a+100*b+10*c+a)):

           return

      for c in range(9,1,-1):

            if((a**b)*(c**a) == (1000*a+100*b+10*c+a)):

                 print a, b, c, a

Niranjan Khanderia - 6 years, 9 months ago
Tan Jia Jin
Aug 30, 2014

Hi everyone. Firstly, the equation is a^b * c^a = abca. The method I used is an assumption. The range for all of the 4 digits is 1-9. So I made the assumption from the smallest digit.

Let a = 2.

So , the equation turns into

2^b * c^2 = 2bc2

From the equation, the answer is a four-digit-number.

Another assumption is made.

Let c = 9. The only reason to this is that putting the largest range of the number will decrease the time taken.

So, 2^b * 9^2 = 2bc2.

9^2 = 81.

The answer must be a four digits containing 2 in the front and another 2 at the back.

Let b = 9.

2^9 = 2080. The multiplication of 2080 and 81 has exceeded the range for the answer which is a four-digits-number containing 2 in the front and 2 at the back.

The following assumptions are made by decreasing the power of 2. Until the the following assumption, 2^5.

2^5 = 32.

32*81 = 2592.

The answer 2592 is correct as the arrangement of the combination of numbers, which is

a^b*c^a=abca

2^5*9^2=2592

a=2

b=5

c=9

This is the method I used to solve this problem. If anyone finds this wrong, please give me some feedback for me to improve myself.

The method I used is assumptions. I hope all of you who can solve the problem with other methods, do write your solutions here for me and the others to learn for more.

My name is TAN JIA JIN, and I come from Malaysia. Thank you. Have a nice day.

Sincerely, TAN.

You have a good solution and correct. I have solved it a little different. You will find the solution below. Best wishes.

Niranjan Khanderia - 6 years, 9 months ago
David Holcer
Mar 21, 2015
1
2
3
4
5
6
7
for a in range(1,11):
    for b in range(1,11):
        for c in range(1,11):
            for d in range(1,11):
                num=1000*a+100*b+10*c+d
                if (a**b)*(c**d)==num:
                    print num

You didn't really need the variable d, but otherwise great solution! I did it exactly the same except with 3 for loops.

Eamon Gupta - 5 years, 9 months ago
Brock Brown
Mar 14, 2015

Python:

1
2
3
4
5
6
7
def goal(n):
    a,b,c,d = (int(i) for i in str(n))
    return n == a**b*c**d
for n in xrange(1000,10000):
    if goal(n):
        print "Answer:", n
        break

Great code !!!

Soutrik Bandyopadhyay - 6 years, 2 months ago
Horisadi Afyama
May 26, 2015

I'm too lazy to write codes, and i like "drag and drop" so... :P

0.04 second , fast enough for me. :P

Aryan Gaikwad
Mar 9, 2015

Java solution -

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
public static void main(String[] args){
    final int min = 1000, max = 9999;
    for(int i = min; i <= max; i++) 
        if(i == div(i)){
            System.out.println(i);
            return;
        }
 }

private static double div(int z){
    String t = String.valueOf(z);
    double[] val = new double[4];
    for (int i = 0; i < 4; i++)
        val[i] = t.charAt(i) - '0';
    return Math.pow(val[2], val[0]) * Math.pow(val[0], val[1]);
} 

Execution time ~0.002 second

Josh Speckman
Aug 26, 2014

This number is a Friedman Number

I have used a java code to find the number.

Ronak Agarwal - 6 years, 9 months ago
Arulx Z
May 11, 2015
1
2
3
4
5
for(int a = 0; a < 10; a++)
    for(int b = 0; b < 10; b++)
        for(int c = 0; c < 10; c++)
            if(Integer.parseInt(a + "" + b + "" + c + "" + a + "") == Math.pow(a, b) * Math.pow(c, a))
                System.out.println("a: " + a + " b: " + b + " c: " + c);

The easiest approach would be to assume values of a and try for b = c = 9 a n d s e e i f a 9 9 a b = c = 9 ~ and~ see~ if~~ a^9 * 9^a is a four digit number. If not got to next value of a. For a =0, 1, we do not get a four digit number.
Next a = 2. 2 9 9 2 = 41472 ~~a = 2.~~~~ 2^9*9^2=41472 ~~~ We get a number greater than four digits. b = 8 , 2 8 9 2 = 20736.. N O b = 7 , 2 7 9 2 = 10368.. N O . . b = 6 , 6 8 9 2 = 5184.. i t i s f o u r d i g i t s , b u t n o t a s w e d e s i r e . b = 5 , 2 5 9 2 = 2592 . . 2592 b=8,~~ ~2^8*9^2=20736..NO…~~~~~~~~~~~~ b=7,~~~ 2^7*9^2=10368..NO..\\ b=6, ~~~6^8*9^2=5184..~~~~it~ is~ four~ digits,~ but~ not~ as~we~desire.\\ b=5, 2^5*9^2=2592…..~~~~\boxed{ 2592 }

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...