Naked Science Forum

Non Life Sciences => Physics, Astronomy & Cosmology => Topic started by: syhprum on 21/05/2008 19:04:16

Title: Arithmatic
Post by: syhprum on 21/05/2008 19:04:16
Not exactly a physics problem but would be physicists must understand maths!
A problem set by a popular magazine with a trivial money prize.

Work out the the last three integers of 3^123456, I make it 883 by a rather clumsy process, does anyone know an elegant way to do it and am I correct.
The prize I believe is about €25 I do not intend to enter.   
Title: Arithmatic
Post by: turnipsock on 21/05/2008 23:05:20
what is ^
Title: Arithmatic
Post by: syhprum on 22/05/2008 06:01:53
Raised to the power of! i.e   2^10 = 1024, 3^2 = 9, 3^123456 = a hell of a lot (don't try this on your pocket calculator).
Title: Arithmatic
Post by: LeeE on 22/05/2008 17:27:18
Bit short of time atm, but there appears to be a repeating pattern for the last and second last digits - the pattern for the last digit cycles over four values and the pattern for the second last appears to cycle over twenty values.
Title: Arithmatic
Post by: JP on 22/05/2008 17:48:29
521

This is according to Mathematica.   I can get the last digit from the cycle from 1->3->9->7->1... of multiplying by 3 each time, but I haven't figured out a pattern to get the 5 and 2 yet.

...

My previous answer was wrong, although it got the right answer.  Here's the "fixed" result.  I think this one should be good...

This relies on finding 3^12 first.

3^12 = 531441, which isn't too tough to do on a calculator, or even by hand if you're feeling like some long multiplication.

The next step is to decompose 123456 in terms of 12*(2^a+2^b+...).  If you do this, you get:

123456=12*(2^13+2^11+2^5+2^4)

Next, you use the property that 3^(a+b+c+d)=3^a*3^b*3^c*3^d:

3^123456=3^[12*(2^13+2^11+2^5+2^4)]=3^(12*2^13)*3^(12*2^11)*3^(12*2^5)*3^(12*2^4).

3^(12*2^n)=3^(12*2*2*2*2*2...*2), which means to take 3^12 and square it n times. You can do this squaring by the earlier method of only retaining the last 3 digits:
3^12=...441
3^(12*2)=(...441)*(...441)=...481
3^(12*2^2)=(...481)*(...481)=...361
3^(12*2^3)=...321
3^(12*2^4)=...041
3^(12*2^5)=...681
3^(12*2^6)=...761
3^(12*2^7)=...121
3^(12*2^8)=...641
3^(12*2^9)=...881
3^(12*2^10)=...161
3^(12*2^11)=...921
3^(12*2^12)=...241
3^(12*2^13)=...081

So back to
3^123456=3^(12*2^13)*3^(12*2^11)*3^(12*2^5)*3^(12*2^4)
3^123456=(...041)*(...681)*(...921)*(...081)=...521
Title: Arithmatic
Post by: syhprum on 22/05/2008 19:46:21
I worked on much the same principal but ran into difficulties after getting to 3^122880 = *****081, this was still 576 short and I did not know the best way to deal with this.
I scoured the internet for a trial version of 'Mathematica' but was unable to find one !.
Title: Arithmatic
Post by: syhprum on 22/05/2008 20:17:43
I hate to disagree with one who has much more mathematics than my sub 'O' education but there are errors in your table

Step 1:  Start from 3^6 = 729
Step 2:  Take (3^6)^6=3^12= ...121 

  (3^6)^6 = 3^36  not 3^12 !
Title: Arithmatic
Post by: DoctorBeaver on 22/05/2008 20:44:16
I hate to disagree with one who has much more mathematics than my sub 'O' education but there are errors in your table

Step 1:  Start from 3^6 = 729
Step 2:  Take (3^6)^6=3^12= ...121 

  (3^6)^6 = 3^36  not 3^12 !

I think you're right.
Title: Arithmatic
Post by: JP on 22/05/2008 21:49:21
I hate to disagree with one who has much more mathematics than my sub 'O' education but there are errors in your table

Step 1:  Start from 3^6 = 729
Step 2:  Take (3^6)^6=3^12= ...121 

  (3^6)^6 = 3^36  not 3^12 !

I think you're right.

Oops!  I added instead of multiplying. :p  Somehow I still got the answer mathematica agreed with... let me fix this up.
Title: Arithmatic
Post by: JP on 22/05/2008 22:43:51
That was quite a bit tougher without my "magic math" (otherwise known as a mistake) to make it work in a few easy steps.  I edited it to post my revised solution.  I think it's right, but I haven't double checked it.
http://www.thenakedscientists.com/forum/index.php?topic=14683.msg175092#msg175092
Title: Arithmatic
Post by: syhprum on 23/05/2008 09:57:27
Many thanks jpetruccelli for the excellent tutorial if I ever have to solve such a problem again will be confident how to do it.

I referred to the problem as one of arithmetic, where does the border line between arithmetic and maths lie?, I think of special relativity as arithmetic and general as maths !.

The 'New Scientist' publishes similar problems each week under the title of 'Enigma' most of which can be solved by a simple brute force program that runs thru all the possibilities but this one seemed to require more specialised knowledge.
Title: Arithmatic
Post by: JP on 23/05/2008 18:39:27
I referred to the problem as one of arithmetic, where does the border line between arithmetic and maths lie?, I think of special relativity as arithmetic and general as maths !.

I bet different people will give you different answers.  For me, arithmetic is when you have a formula (involving multiplication, division, addition, subtraction, roots and powers) and just plug numbers into it to get an answer.  Mathematics is everything else involving numbers.  The solution I gave up above is probably more mathematics, since it involved more steps than just plugging numbers in and calculating.