News:

Happy New Year! Yes, the current one, not a previous one; this is a new post, we swear!

Main Menu

Last Two Digits Problem

Started by Ender, June 21, 2007, 12:47:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ender

Find the last two digits of



Note: The solution is on my blog, so no posting if you look at my blog :P

iago

Let me start the ball rolling by saying that the first four digits are 4393.

We're half way there!

Ender


iago

#3
Is the answer 5689?

Ender: Sorry, I modified this post instead of replying lol.

Ender

Last two digits. But yeah, 89 is correct :P

Did you do that programmatically? If so... how the hell?

iago

#5
Yes, I did. And sorry for not being able to count. :)

Footnote: Java owns

<edit>
Quote
ron@facevision:~$ cat Test.java
import java.math.BigInteger;

public class Test
{
        public static void main(String []args)
        {
                System.out.println(new BigInteger("9").pow(9).pow(9).pow(9));
        }
}

ron@facevision:~$ javac Test.java
ron@facevision:~$ java Test
439328503696464329829774782657072712058010308177126710621676697750466344744764029773301412612482563729435064854354299095570379503452515853238520182740967398746503532324400000659505126023955913142968176998364877699089666171297275956245407453033190168644894850576346492691458695174281789557994923607783461486426448617667076393901104477324982631297641034277093818692823488603426279473674368943609268871793467206677285688478458498235002859256706389043030847945506577080623430066283504397583789044245429585982964571774605868466160379567432725704121260940939343217905975847365096315872153240969882363435363449775254393010368267343970426230801390250903399147001650831878665172798468587509747439118815689

Ender

lol!

JAVA FIGHTING@@!!!~~~

Note: the mathematical solution is still up-for-grabs :P

iago

Don't worry, my friend's working on that. And he's elite. I'll report back later. :)

iago

Well, my friend here figured it out mathematically and showed me, and totally lost me in number theory. It involved mod100 at the start, which made sense. Then he talked about phi and prime factors and recursion and I got confused. So yeah, it's up for grabs. :)

Ender

Hehe. Modular arithmetic is one way to do it. There's also an algebraic way that doesn't require knowledge of number theory. Look on my blog.

Ender

#10
Quote from: iago on June 21, 2007, 10:30:26 AM
Yes, I did. And sorry for not being able to count. :)

Footnote: Java owns

<edit>
Quote
ron@facevision:~$ cat Test.java
import java.math.BigInteger;

public class Test
{
        public static void main(String []args)
        {
                System.out.println(new BigInteger("9").pow(9).pow(9).pow(9));
        }
}

ron@facevision:~$ javac Test.java
ron@facevision:~$ java Test
439328503696464329829774782657072712058010308177126710621676697750466344744764029773301412612482563729435064854354299095570379503452515853238520182740967398746503532324400000659505126023955913142968176998364877699089666171297275956245407453033190168644894850576346492691458695174281789557994923607783461486426448617667076393901104477324982631297641034277093818692823488603426279473674368943609268871793467206677285688478458498235002859256706389043030847945506577080623430066283504397583789044245429585982964571774605868466160379567432725704121260940939343217905975847365096315872153240969882363435363449775254393010368267343970426230801390250903399147001650831878665172798468587509747439118815689


The 89 is right, but that's gotta be wrong, because the number is x-drillions of digits long. Just consider 10^10^10, which is obviously less than 9^9^9^9. 10^10 is ten billion. Raise ten to that power and you will have ten billion and one digits.

Ender

Okay, as to why your answer matched with mine...If you look at my blog answer, it really doesn't matter what n is.

iago

Pfft, you and all the other math geeks in the world do exponents wrong. Left to right! Comp sci for life! :P

rabbit

Well the last digit is easy.  9^n always has a last digit of 1 or 9, so there's that.  I'm not quite sure about the second, but I'll get around to it.