Cancer Posted February 20, 2023 Report Share Posted February 20, 2023 It takes a while to compute the complete distribution of 10d12 by brute force. Quote Link to comment Share on other sites More sharing options...
Old Man Posted February 20, 2023 Report Share Posted February 20, 2023 26 minutes ago, Cancer said: It takes a while to compute the complete distribution of 10d12 by brute force. import random # Set the number of dice and sides num_dice = 10 num_sides = 12 # Roll the dice and record the results results = [random.randint(1, num_sides) for i in range(num_dice)] # Compute the probability distribution dist = {} for result in results: if result in dist: dist[result] += 1 else: dist[result] = 1 for result in sorted(dist.keys()): print(f"{result}: {dist[result]/num_dice:.2%}") Quote Link to comment Share on other sites More sharing options...
Cancer Posted February 20, 2023 Report Share Posted February 20, 2023 Of course. I was doing it by exhaustion, deterministically. Quote Link to comment Share on other sites More sharing options...
Old Man Posted February 20, 2023 Report Share Posted February 20, 2023 My bad. from itertools import product # Set the number of dice and sides num_dice = 10 num_sides = 12 # Compute the probability of each possible outcome outcomes = product(range(1, num_sides+1), repeat=num_dice) dist = {} for outcome in outcomes: total = sum(outcome) if total in dist: dist[total] += 1 else: dist[total] = 1 for total in sorted(dist.keys()): print(f"{total}: {dist[total]/num_sides**num_dice:.6%}") Quote Link to comment Share on other sites More sharing options...
Cancer Posted February 20, 2023 Report Share Posted February 20, 2023 Runtime: hours, with 6e+10 numbers to accumulate. Quote Link to comment Share on other sites More sharing options...
Old Man Posted February 20, 2023 Report Share Posted February 20, 2023 24 minutes ago, Cancer said: Runtime: hours, with 6e+10 numbers to accumulate. We'll see. This Macbook is over ten years old so it won't be quick. Quote Link to comment Share on other sites More sharing options...
Old Man Posted February 21, 2023 Report Share Posted February 21, 2023 No idea how long this would have taken if my laptop hadn't slept for a few hours here and there. 10d12 start: 08:47:49 10: 0.000000% 11: 0.000000% 12: 0.000000% 13: 0.000000% 14: 0.000001% 15: 0.000003% 16: 0.000008% 17: 0.000018% 18: 0.000039% 19: 0.000079% 20: 0.000149% 21: 0.000271% 22: 0.000475% 23: 0.000803% 24: 0.001319% 25: 0.002108% 26: 0.003288% 27: 0.005014% 28: 0.007489% 29: 0.010970% 30: 0.015782% 31: 0.022322% 32: 0.031068% 33: 0.042588% 34: 0.057541% 35: 0.076679% 36: 0.100841% 37: 0.130946% 38: 0.167976% 39: 0.212955% 40: 0.266924% 41: 0.330900% 42: 0.405843% 43: 0.492605% 44: 0.591883% 45: 0.704165% 46: 0.829685% 47: 0.968366% 48: 1.119785% 49: 1.283138% 50: 1.457212% 51: 1.640383% 52: 1.830613% 53: 2.025481% 54: 2.222213% 55: 2.417747% 56: 2.608800% 57: 2.791954% 58: 2.963755% 59: 3.120819% 60: 3.259932% 61: 3.378163% 62: 3.472957% 63: 3.542225% 64: 3.584421% 65: 3.598594% 66: 3.584421% 67: 3.542225% 68: 3.472957% 69: 3.378163% 70: 3.259932% 71: 3.120819% 72: 2.963755% 73: 2.791954% 74: 2.608800% 75: 2.417747% 76: 2.222213% 77: 2.025481% 78: 1.830613% 79: 1.640383% 80: 1.457212% 81: 1.283138% 82: 1.119785% 83: 0.968366% 84: 0.829685% 85: 0.704165% 86: 0.591883% 87: 0.492605% 88: 0.405843% 89: 0.330900% 90: 0.266924% 91: 0.212955% 92: 0.167976% 93: 0.130946% 94: 0.100841% 95: 0.076679% 96: 0.057541% 97: 0.042588% 98: 0.031068% 99: 0.022322% 100: 0.015782% 101: 0.010970% 102: 0.007489% 103: 0.005014% 104: 0.003288% 105: 0.002108% 106: 0.001319% 107: 0.000803% 108: 0.000475% 109: 0.000271% 110: 0.000149% 111: 0.000079% 112: 0.000039% 113: 0.000018% 114: 0.000008% 115: 0.000003% 116: 0.000001% 117: 0.000000% 118: 0.000000% 119: 0.000000% 120: 0.000000% 10d12 stop: 20:44:22 Pariah 1 Quote Link to comment Share on other sites More sharing options...
Old Man Posted February 21, 2023 Report Share Posted February 21, 2023 I forgot to mention that credit for writing the Python code should go to... ChatGPT. Quote Link to comment Share on other sites More sharing options...
Cancer Posted February 21, 2023 Report Share Posted February 21, 2023 Maybe you can talk it into rewriting itself. Quote Link to comment Share on other sites More sharing options...
Logan D. Hurricanes Posted March 8, 2023 Report Share Posted March 8, 2023 Today is World Maths Day! It is also Be Nasty Day, but I'm sure that's just a coincidence. Quote Link to comment Share on other sites More sharing options...
Cancer Posted March 12, 2023 Report Share Posted March 12, 2023 1287821 seems to be largest palindrome number in the first 100,000 primes. Quote Link to comment Share on other sites More sharing options...
Bazza Posted March 12, 2023 Report Share Posted March 12, 2023 Cancer 1 Quote Link to comment Share on other sites More sharing options...
Cancer Posted March 12, 2023 Report Share Posted March 12, 2023 That's something like a Sieve of Eratosthenes plotted in polar coordinates. Interesting. Quote Link to comment Share on other sites More sharing options...
Bazza Posted March 12, 2023 Report Share Posted March 12, 2023 Yes, I think it comes from the same source (ie I remember the Sieve of Eratosthenes mentioned from the DVD I just watching last night. (I got the image from the author's website). I'm sure you picked up that the circle is divided into 24 segments and noticed the Maltese Cross. I thought of posting it to the latest Superdraft thread it it is related to my academic school of qualitative geometry. More to come after the weekend. Quote Link to comment Share on other sites More sharing options...
Cancer Posted March 12, 2023 Report Share Posted March 12, 2023 I suspect that if you plotted many more numbers on that pattern, the Maltese cross would become muted, perhaps fade away entirely, or become restricted to an inner core, once you had, say, 10000 primes in the display. Other patterns might appear. Plotting it with 24 segments to the circle means that important sequences of composite numbers (multiples of 2, 3, 4, 6, and 12) appear as rays emanating from the center. Carefully increasing the number of segments would do that for more such sequences. The next important case is 60 segments around the circle, and then the multiples of 5 would make radial rays. After that you need 420 segments so that the multiples of 7 make rays of their own as well. I hadn't seen this sort of format before, and I find myself thinking about what it would look like in a 3-dimensional spherical plot and how the best way to display such a thing would work. You'd need to use zonal harmonics, I think, but there could well be other tricks that don't occur to me. Quote Link to comment Share on other sites More sharing options...
Cancer Posted March 12, 2023 Report Share Posted March 12, 2023 Though I just noticed this morning an oddity: 1 is indicated as a prime (which technically it is not), and 2 and 3 are not indicated as primes, which both most definitely are. Those corrections mar the Maltese cross pattern, of course. Quote Link to comment Share on other sites More sharing options...
Bazza Posted March 12, 2023 Report Share Posted March 12, 2023 Yes, agree with you. Will hopeful to reply tomorrow (later today) in full when it is not 12:56 am Monday. Quote Link to comment Share on other sites More sharing options...
Logan D. Hurricanes Posted March 13, 2023 Report Share Posted March 13, 2023 Old Man 1 Quote Link to comment Share on other sites More sharing options...
Logan D. Hurricanes Posted March 29, 2023 Report Share Posted March 29, 2023 High school students make math discovery 2,000 years in the making tkdguy 1 Quote Link to comment Share on other sites More sharing options...
Logan D. Hurricanes Posted March 31, 2023 Report Share Posted March 31, 2023 L. Marcus 1 Quote Link to comment Share on other sites More sharing options...
Bazza Posted March 31, 2023 Report Share Posted March 31, 2023 *chuckle* Quote Link to comment Share on other sites More sharing options...
Cancer Posted March 31, 2023 Report Share Posted March 31, 2023 Yeah, it should be 42, not zero. Quote Link to comment Share on other sites More sharing options...
Logan D. Hurricanes Posted April 9, 2023 Report Share Posted April 9, 2023 Pariah 1 Quote Link to comment Share on other sites More sharing options...
Logan D. Hurricanes Posted May 6, 2023 Report Share Posted May 6, 2023 Pariah and Starlord 1 1 Quote Link to comment Share on other sites More sharing options...
Cancer Posted May 17, 2023 Report Share Posted May 17, 2023 On the down side, I think that at least a third of the kids in my Solar System astronomy class this term can't read scientific notation. They'd rather count zeros than see 2 ×1030 kg. tkdguy 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.