Results 1 to 8 of 8
Like Tree2Likes
  • 2 Post By JosAH

Thread: Help with Program

  1. #1
    CodeX Pro is offline Member
    Join Date
    Dec 2012
    Posts
    32
    Rep Power
    0

    Default Help with Program

    A googol (10^100) is a massive number: one followed by one-hundred zeros; 100^100 is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.

    Considering natural numbers of the form, a^b, where a, b < 100, what is the maximum digital sum?
    Can anyone help me with the above program implemented in Java. I am not understanding a bit. Please help me with the code.

    Thank you,
    Sincerely,
    Psycho_Coder
    Last edited by CodeX Pro; 06-05-2013 at 12:24 PM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help with Program

    I don't understand your notation, e.g. what does 'a, b 100' mean?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    927
    Rep Power
    2

    Default Re: Help with Program

    We would love to help you with the code, but there is none. What do you have so far? Which part do you have problems with? If you have nothing yet, I suggest you slide away your keyboard and start with pen and paper. Write down what you think are the steps needed to solve your problem.

  4. #4
    CodeX Pro is offline Member
    Join Date
    Dec 2012
    Posts
    32
    Rep Power
    0

    Default Re: Help with Program

    Quote Originally Posted by JosAH View Post
    I don't understand your notation, e.g. what does 'a, b 100' mean?

    kind regards,

    Jos
    Sorry sir I had made some mistakes. I have edited the thread. Sorry for the harassment

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help with Program

    Quote Originally Posted by CodeX Pro View Post
    Sorry sir I had made some mistakes. I have edited the thread. Sorry for the harassment
    Let ds(x) be the digital sum of x; ds(a^b) == ds(ds(a)^b); the maxmum value for ds(x) is 9 and ds(9^n) == 9, so for any value of a where ds(a) == 9 and ds(a^b) also equals 9.

    kind regards,

    Jos
    SurfMan and CodeX Pro like this.
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    927
    Rep Power
    2

    Default Re: Help with Program

    Quote Originally Posted by JosAH View Post
    Let ds(x) be the digital sum of x; ds(a^b) == ds(ds(a)^b); the maxmum value for ds(x) is 9 and ds(9^n) == 9, so for any value of a where ds(a) == 9 and ds(a^b) also equals 9.

    kind regards,

    Jos
    Just... wow... :)

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default Re: Help with Program

    Quote Originally Posted by SurfMan View Post
    Just... wow... :)
    There's nothing wow about it; it's just bean counter logic and it saves you from writing tedious program code ;-)

    kind regarrds,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,507
    Rep Power
    5

    Default Re: Help with Program

    Considering natural numbers of the form, a^b, where a, b < 100, what is the maximum digital sum?
    First some clarity. A digit sum is a one time sum of the digits of a number. So the digital sum of 12345 = 15. The repeated digital sum or digital root of the same is 6 because the procedure is recursive.

    Perhaps I missed something here but it seems to me the maximum of a digital root is 9 is obvious. You can always recursively sum up the resulting digits until you are left with a single digit. And since 3^2 fits the description you got 9.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. Replies: 4
    Last Post: 11-21-2012, 01:19 PM
  2. Replies: 2
    Last Post: 04-02-2011, 12:57 PM
  3. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •