Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3852314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:17:57+00:00 2026-05-19T17:17:57+00:00

I’m working on Project Euler problem number 205 which states: Peter has nine four-sided

  • 0

I’m working on Project Euler problem number 205 which states:

Peter has nine four-sided (pyramidal)
dice, each with faces numbered 1, 2,
3, 4. Colin has six six-sided (cubic)
dice, each with faces numbered 1, 2,
3, 4, 5, 6.

Peter and Colin roll their dice and
compare totals: the highest total
wins. The result is a draw if the
totals are equal.

What is the probability that Pyramidal
Pete beats Cubic Colin? Give your
answer rounded to seven decimal places
in the form 0.abcdefg

My initial attempt (below) involved having 1,000 “games”, where each game had 1,000,000 turns. Then taking the average of all the games. I’m consistently getting results in the .559 area, but when the answer needs to be to 7 decimal places, that’s not that close.

public class pe205 {

    public static void main(String[] args) {

        pe205 p = new pe205();

        double sum = 0.0;

        for(int i=0; i < 1000; i++){
            sum += p.determineProbability();
        }

        System.out.println(sum/1000.0);

    } // end main

    public double determineProbability(){

        int peterWins = 0;
        int colinWins = 0;

        for(int i=0; i < 1000000; i++){

            int peterSum = 0;
            for(int j=0; j < 4; j++){
                Random r = new Random();
                peterSum += r.nextInt(9);
            }

            //System.out.println(peterSum);

            int colinSum = 0;
            for(int j=0; j < 6; j++){
                Random r = new Random();
                colinSum += r.nextInt(6);
            }

            //System.out.println(colinSum);

            if(peterSum > colinSum){
                peterWins++;
            }
            if(colinSum > peterSum){
                colinWins++;
            }

        }
        double peteBeatsColin = (double)peterWins/(double)(colinWins + peterWins);

        return peteBeatsColin;

    }

} // end class

I’ve read about the Monte Carlo method. Would this be a situation where that would be useful, and if so, could someone give me a brief walk through? Or is it that I’m missing some fairly obvious mathematical solution?

I would like to say that I enjoy the challenge of these problems, and I’m not looking for the answer, just a little push in the right direction.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:17:58+00:00Added an answer on May 19, 2026 at 5:17 pm

    Why not try to calculate the result combinatorially? Explicitly calculate the result by adding terms of the form

    a_i = P(peter throws i, Colin throws < i)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.