Jump to content

A Game of Numbers


Starlord

Recommended Posts

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%}")
Link to comment
Share on other sites

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%}")
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 4 weeks later...
  • 2 weeks later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...