Thread Rating:

Poll

21 votes (45.65%)
14 votes (30.43%)
6 votes (13.04%)
3 votes (6.52%)
12 votes (26.08%)
3 votes (6.52%)
6 votes (13.04%)
5 votes (10.86%)
12 votes (26.08%)
10 votes (21.73%)

46 members have voted

DogHand
DogHand
  • Threads: 2
  • Posts: 2101
Joined: Sep 24, 2011
Thanked by
Ace2
May 21st, 2025 at 7:17:21 AM permalink
Ace2,

So would 22, 44, 66 qualify, since they have 11 in common? Your calculation seems to preclude this set, since they also share a common factor of 2.

Dog Hand
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
May 21st, 2025 at 11:10:26 AM permalink
Quote: DogHand

Ace2,

So would 22, 44, 66 qualify, since they have 11 in common? Your calculation seems to preclude this set, since they also share a common factor of 2.

Dog Hand
link to original post

Good catch. One must be very precise when using sets/logical arguments/inclusion-exclusion. I modified my answer below (in caps).

Therefore, the chance that three random integers share a MINIMUM factor >10 is 0.1681 - 0.1666 = 0.15%.

Put another way, over 99% (1666/1681) of SETS WITH shared factors will INCLUDE 2,3,5 or 7.
It’s all about making that GTA
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
May 22nd, 2025 at 5:46:58 PM permalink
My conjectures on the average gap between prime numbers are:

ln(x) is the average gap at x.
ln(x) - 1 is the average gap from 1 to x
ln(x) * (pi)^.5/2 is the standard deviation of the average gap at x
It’s all about making that GTA
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
May 28th, 2025 at 11:02:23 AM permalink
It takes five days to paddle a canoe down a river with the current.
It takes seven days to paddle a canoe up the same river against the current.
1. How long would it take with no current?
2. How long would it take to get down the river with the usual current without a paddle?
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
May 28th, 2025 at 11:30:08 AM permalink


1) 35/6 = 5.83 days
2) 35 days

Last edited by: Ace2 on May 28, 2025
It’s all about making that GTA
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
May 28th, 2025 at 12:59:46 PM permalink

Let C be the speed of the canoe, and W the speed of the current
In terms of what fraction of the river is covered per day:
C + W = 1/5
C - W = 1/7
2C = 1/5 + 1/7 = 12/35 -> C = 6/35, so it would take the canoe 35/6 days, or 5 days, 20 hours
2W = 1/5 - 1/7 = 2/35 -> W = 1/35, so a drifting canoe would take 35 days

charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 3052
Joined: Jun 17, 2011
May 29th, 2025 at 3:35:55 AM permalink
If the river had been 35 miles then down stream with paddle would be 7mpd (miles per day). Upstream 5mpd. Hence p+x=7, p-x=5. p=6, x=1. Thus gets 35/6 and 35.
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
May 29th, 2025 at 7:19:55 AM permalink
I agree with the answers posted!
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 1st, 2025 at 2:21:23 AM permalink
Here is another classic that has probably been asked before.

There are 100 light switches, all initially in the off position.

There are 100 people, numbered 1 to 100.

Person 1 flips every switch.
Person 2 flips every 2nd switch (2, 4, 6, ...)
Person 3 flips every 3rd switch (3, 6, 9...)
Person n flips every nth switch (n, 2n, 3n -- up to 100)

After all 100 people, which switches are up?
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
Thanked by
Wizard
June 1st, 2025 at 8:56:08 AM permalink
This is usually asked with school lockers.
Person N will flip every switch that is a multiple of N.
This is equivalent to, Switch N will be flipped by every person who is a factor of N.
The numbers with an odd number of factors will end up being flipped an odd number of times, and thus remain on.
Note that, pretty much by definition of factor, if K is a factor of N, then N/K is also a factor of N. Thus, every number "should" have an even number of factors.
However, for squares, if K is the square root of N, then N/K = K, so squares have an odd number of factors.
The switches that are up are 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.

Variation on the problem:
There are 1000 switches, and 500 people, numbered 1, 3, 5, ..., 997, 999. How many switches will be on after these 500 people have acted?
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 1st, 2025 at 7:15:05 PM permalink
Quote: ThatDonGuy


Person N will flip every switch that is a multiple of N.
This is equivalent to, Switch N will be flipped by every person who is a factor of N.
The numbers with an odd number of factors will end up being flipped an odd number of times, and thus remain on.
Note that, pretty much by definition of factor, if K is a factor of N, then N/K is also a factor of N. Thus, every number "should" have an even number of factors.
However, for squares, if K is the square root of N, then N/K = K, so squares have an odd number of factors.
The switches that are up are 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.



I agree!
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 2nd, 2025 at 3:25:17 PM permalink
Quote: ThatDonGuy

This is usually asked with school lockers.

Person N will flip every switch that is a multiple of N.
This is equivalent to, Switch N will be flipped by every person who is a factor of N.
The numbers with an odd number of factors will end up being flipped an odd number of times, and thus remain on.
Note that, pretty much by definition of factor, if K is a factor of N, then N/K is also a factor of N. Thus, every number "should" have an even number of factors.
However, for squares, if K is the square root of N, then N/K = K, so squares have an odd number of factors.
The switches that are up are 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.

Variation on the problem:
There are 1000 switches, and 500 people, numbered 1, 3, 5, ..., 997, 999. How many switches will be on after these 500 people have acted?
link to original post

53

All odd squares (like the last solution) plus all 2^x (would only be flipped once by person1) plus any combination of those two. So, for instance, 392 would be on since it’s 7^2 * 2^3

It’s all about making that GTA
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 2nd, 2025 at 4:15:59 PM permalink
Quote: Ace2

Quote: ThatDonGuy

This is usually asked with school lockers.

Person N will flip every switch that is a multiple of N.
This is equivalent to, Switch N will be flipped by every person who is a factor of N.
The numbers with an odd number of factors will end up being flipped an odd number of times, and thus remain on.
Note that, pretty much by definition of factor, if K is a factor of N, then N/K is also a factor of N. Thus, every number "should" have an even number of factors.
However, for squares, if K is the square root of N, then N/K = K, so squares have an odd number of factors.
The switches that are up are 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.

Variation on the problem:
There are 1000 switches, and 500 people, numbered 1, 3, 5, ..., 997, 999. How many switches will be on after these 500 people have acted?
link to original post

53

All odd squares (like the last solution) plus all 2^x (would only be flipped once by person1) plus any combination of those two. So, for instance, 392 would be on since it’s 7^2 * 2^3


link to original post


Correct.
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 2nd, 2025 at 7:15:46 PM permalink
Quote: Wizard

Here is another classic that has probably been asked before.

There are 100 light switches, all initially in the off position.

There are 100 people, numbered 1 to 100.

Person 1 flips every switch.
Person 2 flips every 2nd switch (2, 4, 6, ...)
Person 3 flips every 3rd switch (3, 6, 9...)
Person n flips every nth switch (n, 2n, 3n -- up to 100)

After all 100 people, which switches are up?
link to original post

Here’s an easy variation: There are 10,000 switches, all initially in the ON position. There are 10,000 people numbered 1 to 10,000

The switches are semi-smart…they will change position up to a maximum of three times, then they stay wherever they are

After all 10,000 people, how many switches are ON?
It’s all about making that GTA
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 2nd, 2025 at 7:35:15 PM permalink
Quote: Ace2

Here’s an easy variation: There are 10,000 switches, all initially in the ON position. There are 10,000 people numbered 1 to 10,000

The switches are semi-smart…they will change position up to a maximum of three times, then they stay wherever they are

After all 10,000 people, how many switches are ON?
link to original post



...you know that there are 1229 primes less than 10,000
If a switch is switched three times, it will remain off. For N > 1, switch N will be switched by person 1 and by person N, so it remains on only if N has no other factors - i.e. if N is prime. Note that since 1 has only one factor, switch 1 will be switched once, and then remain off.
Thus, there will be 1229 switches that are on.

Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
Thanked by
Dieter
June 2nd, 2025 at 8:43:42 PM permalink
It’s easy if you don’t know how many primes there are <n. It’s easy because it can be answered with a couple swipes of a slide rule

Applying Ace2’s Third Conjecture, 10,000 / (Ln(10,000) - 1) gives 1,218 primes, within 1% of the exact answer. Ace2 will always accept a formulaic answer within 1% unless an exact closed-form solution is feasible
Last edited by: Ace2 on Jun 2, 2025
It’s all about making that GTA
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 8th, 2025 at 3:10:25 PM permalink
On average, how many people do you need to randomly select to get three people with a matching birthday?
It’s all about making that GTA
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 9th, 2025 at 2:36:10 PM permalink
Quote: Ace2

On average, how many people do you need to randomly select to get three people with a matching birthday?
link to original post



A closed form on this one escapes me.

Next, I reverted to a spreadsheet, but that is turning into a huge mess and the probabilities don't add up. What makes it tricky is there can be lots of possible double birthdays before you find the third. The more doubles, the more likely it is.

Let me see if I at least have the probabilities for up to 4 right:

3 people = 1 in 133,225
4 people = 1 in 44,530
5 people = 1 in 22,326
6 people = 1 in 13,433
Last edited by: Wizard on Jun 9, 2025
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 9th, 2025 at 4:16:21 PM permalink
Wizard, I think you read the problem wrong. He is not looking for a probability.

I generated a brute force exact number - note this assumes that each of the 366 possible birthdays is equally likely:

Result is
2 67460 85609 50321 71026 36624
41401 48871 35730 86979 71731 33351 16424 49860 98256 72587
25578 23561 16270 82326 22161 55903 71818 89868 48856 37586
78632 11521 10050 90352 79956 69225 06347 11967 38045 10424
90961 48253 20759 23840 88703 86312 49940 89435 31115 69286
33329 95386 32201 41496 33504 38869 30313 44288 03946 04290
96799 91488 30917 44964 66538 31661 87364 54963 81640 96082
48478 95127 31375 34239 28706 30838 62666 49842 28037 88388
81640 97463 24394 19833 79229 17842 15864 21569 33109 57883
08960 05746 34021 11121 39409 69910 02073 41187 79475 30846
17028 35815 51060 54272 21543 24539 97099 01203 26414 13933
20069 76692 32886 75762 56597 58848 94706 08767 96915 18855
68678 53148 44872 91300 42868 86188 86257 88974 67114 73025
14287 51028 54191 97353 94281 65307 15501 33937 64753 46701
25545 69612 30388 13646 52292 03420 52132 77585 22757 14926
32416 51114 71621 41095 58176 83551 17604 13857 02991 19441
44933 22199 05016 93438 14790 33609 79541 72757 20323 90207
60125 74993 59525 54849 13131 37334 75181 87355 19233 40736
75686 82257 02704 16638 92495 16889 52865 04508 25002 05119
07560 67765 48223 51616 89284 29560 36315 60166 59480 46445
88605 40130 36340 46586 46500 73746 62090 99584 45094 72956
54720 36153 32391 75941 79804 74913 18676 60262 45214 92668
18283 39845 54418 76633 43113 87492 90152 54259 96766 75297
34653 61285 27783 63392 24333 29029 48888 70755 06134 49884
99628 22362 96609 20808 49778 49769 05865 19675 46911 47853
76497 37083 92890 45298 75782 07340 78815 50076 15761 97941
45625 06864 28066 40967 66507 73417 88309 00174 22304 70316
71563 37969 14983 40885 90283 47351 76790 55154 26367 25397
63062 96738 89910 99968 65520 36177 55283 52140 84916 05766
96095 34663 94112 60806 43010 21884 40879 27243 77395 45215
60499 93415 61497 04419 62221 48740 21917 29196 77395 06691
27183 20384 39409 73423 00296 15711 83272 70104 50576 68039
/
3008 72563 48416 68636 18819
39145 86682 42049 20431 61509 94775 51296 12774 78037 36321
26352 09878 66197 57916 05057 97036 52473 60423 92552 31367
86325 32324 29283 55605 56936 57921 48736 64051 62981 80942
42230 95761 40876 43314 38529 12169 67347 66461 42649 15307
09354 29837 37642 42376 40620 65500 77479 75765 82392 29804
93327 22333 93839 86821 29375 92080 09977 12227 33771 34001
46264 33965 99882 29690 76711 41200 29607 50522 22391 12178
03433 85124 63776 36104 80340 70670 55030 09339 26028 45456
96448 78510 17015 22799 80180 35338 84734 84908 15401 49487
26360 27783 11951 30255 70100 12757 68480 79799 90626 28767
96867 20650 72485 28140 83127 35377 00345 30433 29264 27049
32937 68419 91024 14726 61678 03575 17188 55204 04329 95680
45907 35586 09843 66844 11178 18670 08728 21773 16789 74581
97965 57787 24375 43522 64025 54679 87019 99247 12917 77533
30293 36026 50523 45702 10738 77421 00951 99639 48152 93227
93184 21445 27071 21422 64343 49156 44063 34689 94517 19054
78592 15835 04702 41293 31243 82394 26932 86073 76761 80973
26673 64853 45887 72932 37725 84515 38956 85139 89216 47226
38467 06899 17816 39219 59285 49447 89343 37924 20017 87340
90309 04261 85955 71466 02458 52892 33295 78960 60494 19926
54875 05998 72953 81296 48491 42478 04430 18558 03560 15788
49271 32647 27980 77761 79421 18890 29238 54098 24660 46666
81337 89341 98173 24580 50255 60685 06438 56155 93076 97628
57988 72956 02242 95697 06480 63022 04895 98049 94395 97946
30361 95340 87650 49648 99611 97079 25963 68898 82559 14320
83138 77971 08885 08552 79257 90850 76292 00080 80970 97828
91615 83683 49027 73504 94030 09637 28868 20392 22149 66943
43222 82631 14728 82188 43525 26579 59826 44125 03061 96512
92348 02470 68483 42787 76414 61398 37442 61897 80689 83927
52087 93628 79374 99611 69758 83001 65039 04891 31395 86283
18805 99280 76740 91743 56648 33935 52970 85096 40450 37568
or about 88.895

Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 9th, 2025 at 4:36:51 PM permalink
Quote: ThatDonGuy

Wizard, I think you read the problem wrong. He is not looking for a probability.
link to original post



No, I don't so. The way I'm doing this is taking the dot product of the number of people and the probability it takes exactly that number. Getting those probabilities is tricky and I'm doing it one at a time.

Also, I'm assuming 365 days in a year, not 366.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 9th, 2025 at 4:49:11 PM permalink
TDG,

I agree with your answer for 366 birthdays, but brute-forcing is not an acceptable method.

Note: my answer will be for 365 birthdays
It’s all about making that GTA
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 9th, 2025 at 4:53:17 PM permalink
Quote: Wizard

[

Let me see if I at least have the probabilities for up to 4 right:

3 people = 1 in 133,225
4 people = 1 in 44,530
5 people = 1 in 22,326
6 people = 1 in 13,433
link to original post

I wouldn’t know, because I didn’t solve it that way
It’s all about making that GTA
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 10th, 2025 at 4:11:44 AM permalink
Quote: Ace2

I wouldn’t know, because I didn’t solve it that way
link to original post



It occurred to me at 4AM the similarity between this one and your question about the rolls required to obtain the same side twice with a six-sided die. Lest I spoil the fun, I'll put the answer in spoiler tags.





I do not know how to adapt that to the same event three times. I give up.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 10th, 2025 at 6:52:36 AM permalink
Quote: Wizard

Quote: Ace2

I wouldn’t know, because I didn’t solve it that way
link to original post



It occurred to me at 4AM the similarity between this one and your question about the rolls required to obtain the same side twice with a six-sided die. Lest I spoil the fun, I'll put the answer in spoiler tags.





I do not know how to adapt that to the same event three times. I give up.
link to original post



Quote: Ace2

For an n-sided die, the expected number of rolls to hit any side twice is the integral from zero to infinity of:

(((x/n)+ 1) / e^(x/n))^n dx

So, for example, the expected number of rolls to hit any side twice for a 200-sided die is the integral from zero to infinity of

(((x/200)+ 1) / e^(x/200))^200 dx

Which evaluates to ~18.398 rolls. I can post the exact answer but it's a very long fraction

The Poisson terms of the aforementioned formula can be easily expanded to calculate the expected number of rolls to hit any side k times. For instance, the expected number of rolls to hit any side five times for a 200-side die is the integral from zero to infinity of :

(((x/200)^4/4! + (x/200)^3/3! + (x/200)^2/2 + (x/200) + 1) / e^(x/200))^200 dx
link to original post


In this case, we are rolling a 365-sided die until the same side comes up 3 times, so it is the integral from 0 to positive infinity of:

( ((x / 365)^2 / 2 + (x / 365) + 1) / e^(x / 365) )^365 dx

which equals

((x / 365)^2 / 2 + (x / 365) + 1)^365 / e^x dx

Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 10th, 2025 at 8:31:57 AM permalink
Quote: ThatDonGuy



( ((x / 365)^2 / 2 + (x / 365) + 1) / e^(x / 365) )^365 dx

which equals

((x / 365)^2 / 2 + (x / 365) + 1)^365 / e^x dx


link to original post



I ran both those integrals through https://www.integral-calculator.com/, but no answer could be found within the time limit. Can anyone suggest another integral calculator that is more patient?
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
unJon
unJon
  • Threads: 17
  • Posts: 4943
Joined: Jul 1, 2018
June 10th, 2025 at 9:25:11 AM permalink
Quote: Wizard

Quote: ThatDonGuy



( ((x / 365)^2 / 2 + (x / 365) + 1) / e^(x / 365) )^365 dx

which equals

((x / 365)^2 / 2 + (x / 365) + 1)^365 / e^x dx


link to original post



I ran both those integrals through https://www.integral-calculator.com/, but no answer could be found within the time limit. Can anyone suggest another integral calculator that is more patient?
link to original post



Wolfram Alpha just did it for me no problem.

https://www.wolframalpha.com/input?i=integral+zero+to+infinity+%28%28x+%2F+365%29%5E2+%2F+2+%2B+%28x+%2F+365%29+%2B+1%29%5E365+%2F+e%5Ex+dx
The race is not always to the swift, nor the battle to the strong; but that is the way to bet.
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 10th, 2025 at 12:18:31 PM permalink
Kudos to all participants.

The expected number of trials for an event to happen is the sum of the probabilities of it never happening over all time(a). For this problem, the event is when any birthday happens three times so we sum the probability of all 365 birthdays being at states 0, 1, and 2 for all time. Apply Poisson and integrate from zero to infinity:

(((x/365)^2/2 + (x/365) + 1) / e^(x/365))^365 dx

As Wizard noted, integral-calculator times out with this one so I used excel to evaluate the integral at these intervals:

1: 89.239
0.1: 88.789
0.01: 88.744
0.001: 88.739

So I was confident with an answer of 88.74, which later agreed to the Wolfram answer posted by UnJon. It's good to integrate these "manually" in excel sometimes as it reinforces the understanding of the integral. In this case, I integrated from zero to 300 since the answers had clearly converged to five digits by 300

(a) This is essentially just the geometric series. For instance, the expected number of rolls of a single die until a 4 appears is the sum of the probabilities of it never happening over all time, so: (5/6)^0 + (5/6)^1 + (5/6)^2 + ....= 6.
Last edited by: Ace2 on Jun 10, 2025
It’s all about making that GTA
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 10th, 2025 at 12:36:10 PM permalink
I get 88.73892


141 42300 64909 11005 74195
31360 92353 26990 43759 14267 35009 12860 19045 27335 42755
81418 56369 91945 64783 36028 47736 67046 79466 70874 66177
83481 17383 92625 30510 70348 82550 60337 94576 08947 13317
74152 39242 34837 05292 31670 07955 11188 46061 83826 42198
88792 60277 99110 08847 50759 71699 41309 57360 82004 81980
52394 77619 32695 97630 47674 32734 65158 28167 00996 21945
20847 20665 26499 05696 98066 99547 81108 22201 98597 51479
09464 63631 00095 33194 55168 87348 70389 55782 88288 42844
84610 75900 11771 54928 40960 24502 72666 98337 52969 10269
98231 94522 42450 02333 93446 83121 45158 23802 09330 88432
74183 77379 46539 91078 66706 79976 04998 45474 14238 55363
86661 40688 86523 93930 12127 82208 24406 37891 08983 54973
88321 61169 40271 84983 99018 37265 17660 59014 82941 99252
44415 19194 92203 84242 37904 16221 04085 42344 24230 74163
00719 51720 06397 79961 86966 55278 41024 89347 85848 27665
83831 17920 54686 83112 63623 55846 77216 82924 40905 78232
87780 71232 48232 74562 61175 46278 72502 33406 91796 02089
05064 54726 31197 98379 20693 45402 64403 84357 56280 36630
79530 42523 86809 14231 12723 67464 60865 81278 25303 33398
32494 47009 29992 61028 06253 13179 96966 45163 52480 89078
91917 16254 90364 83826 23840 04338 63506 28814 64280 78999
31945 43223 97184 10858 59999 10818 12341 65706 45052 00047
82641 53245 86759 07118 23630 62921 67298 08339 72215 28591
09212 63816 21737 24233 63535 85399 88293 64884 51916 05254
97311 22945 99779 79088 36058 78985 50010 01909 46610 82691
15169 04866 60655 26706 11053 05439 04737 91852 19546 33816
19404 34836 97619 05877 39131 07898 37088 20113 15346 71035
70622 42882 87381 22184 09139 57230 74313 94488 07556 81402
30625 42338 90089 51774 09402 05346 01236 99611 42864 86555
36182 46970 42186 16638 25909 34228 76947 14540 95228 83564
57028 91781 98277 51627 77652 34044 11031 66941 23430 54739
59906 14465 61311 11535 79131 97158 99088 88525 52502 18515
81611 02005 18672 85103 85317 78809 48252 15740 65054 96826
44020 92191 49092 34018 49655 12700 67196 43889 97343 78363
/
1 59369 76721 72892 18418
98026 21073 15687 46447 30004 58951 80077 87555 40006 86071
47809 42212 32503 44799 41050 27914 82854 85266 74711 69891
20923 09571 26920 47277 21944 13243 95661 80123 25960 78057
59413 20378 17423 61899 30928 14716 03590 23806 37761 77291
08319 53015 61924 66592 02787 13800 53420 89908 38076 29838
51102 81952 50893 53239 01148 98152 57832 88478 92167 29637
19296 87612 25698 90069 44165 53116 18767 85375 42825 88563
10771 14674 16915 35791 56305 37100 10908 20279 29513 64939
32572 62975 81628 02960 77450 83642 12448 05444 75636 80864
90837 25445 45809 55859 72856 97410 21439 13388 88981 98871
81973 29022 47073 85050 44281 43681 06970 59502 17098 58731
44412 48225 41077 12910 91534 59799 97099 26461 84170 65583
79976 45823 33754 68455 75822 98095 90361 25936 99605 33435
02700 41360 03849 40104 44674 58672 69116 47349 37455 92248
34424 46541 41801 09190 42634 16052 26101 60761 55929 74585
33716 00592 85701 30832 78363 65413 07889 46336 28522 00029
51823 89066 03176 67363 78127 33032 79622 97035 90449 11724
12128 96321 76075 64529 71661 87733 99205 51741 52708 21078
24289 50968 92893 62827 13401 65548 06009 02948 26121 78112
16612 65038 84012 20869 31604 85356 46182 71213 41915 26717
61233 90285 56201 09190 10562 40406 02614 21490 67528 32520
24710 94643 57579 47840 39453 53718 33393 78068 95115 13259
55800 50925 68457 34586 09428 54621 48760 73292 12979 73087
37420 51603 61729 52965 80323 27430 35430 72894 50598 99257
72856 47492 13571 67316 13405 31822 64939 09198 95605 81686
63685 10507 85128 58148 72680 44892 75781 52307 95210 81691
33462 20727 39537 73030 25875 40819 13860 14926 95079 60936
95000 89208 13497 59543 32000 51522 24467 98575 31980 75988
82636 75147 23794 78852 27475 71006 90053 68840 45348 36295
05725 69744 03740 27703 74942 77586 71953 02482 62137 18574
38619 12513 55720 92623 74642 26512 33061 25597 70566 51007
89646 33862 28152 85010 07603 50437 39052 57516 48755 73997
65223 53939 95539 17462 97377 26545 43609 25632 54554 97374
02308 07994 35025 94488 79114 64320 49572 46780 39550 78125

Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 10th, 2025 at 12:40:55 PM permalink
Now that we know the expected number of people to get three matching birthdays, what’s the variance?
It’s all about making that GTA
unJon
unJon
  • Threads: 17
  • Posts: 4943
Joined: Jul 1, 2018
June 10th, 2025 at 1:36:38 PM permalink
Quote: Ace2

Kudos to all participants.

The expected number of trials for an event to happen is the sum of the probabilities of it never happening over all time(a). For this problem, the event is when any birthday happens three times so we sum the probability of all 365 birthdays being at states 0, 1, and 2 for all time. Apply Poisson and integrate from zero to infinity:

(((x/365)^2/2 + (x/365) + 1) / e^(x/365))^365 dx

As Wizard noted, integral-calculator times out with this one so I used excel to evaluate the integral at these intervals:

1: 89.239
0.1: 88.789
0.01: 88.744
0.001: 88.739

So I was confident with an answer of 88.74, which later agreed to the Wolfram answer posted by UnJon. It's good to integrate these "manually" in excel sometimes as it reinforces the understanding of the integral. In this case, I integrated from zero to 300 since the answers had clearly converged to five digits by 300

(a) This is essentially just the geometric series. For instance, the expected number of rolls of a single die until a 4 appears is the sum of the probabilities of it never happening over all time, so: (5/6)^0 + (5/6)^1 + (5/6)^2 + ....= 6.
link to original post



Potentially dumb question:

It feels like there should be a difference in the formula for expected trials to completion when it is possible that the number of trials before it happens is infinite. Rolling a 4 falls into this category. Versus a situation where the event will certainly happen within a certain number of trials. For instance the probability is 100% that by trial 731 there will be a birthday picked at least 3 times. The experiment will never ever get to trial 732.

It feels like the difference between picking balls from an urn with replacement and without replacement.

Ace2, your Poisson formula ignores this difference.

Ok maybe this wasn’t a question, but something (else) I just don’t get about this methodology.
The race is not always to the swift, nor the battle to the strong; but that is the way to bet.
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
Thanked by
unJon
June 10th, 2025 at 2:39:50 PM permalink
Quote: unJon


Potentially dumb question:

It feels like there should be a difference in the formula for expected trials to completion when it is possible that the number of trials before it happens is infinite. Rolling a 4 falls into this category. Versus a situation where the event will certainly happen within a certain number of trials. For instance the probability is 100% that by trial 731 there will be a birthday picked at least 3 times. The experiment will never ever get to trial 732.

It feels like the difference between picking balls from an urn with replacement and without replacement.

Ace2, your Poisson formula ignores this difference.

Ok maybe this wasn’t a question, but something (else) I just don’t get about this methodology.
link to original post


I had the same question when I started doing Poisson integrations. Here's a simple way to prove that they work for discrete cases and also for cases with an innate trial limit:

If you roll a single die until any number appears, the expected number of rolls is obviously 1 and is always 1. You could integrate from zero to infinity:

(1/e^(x/6))^6 dx

and also get the answer of 1. Though the actual die roll is discrete and starts/ends at 1 every time, that integral starts at zero and "ends" at infinity...continuously adding the probability that none of the six numbers have been rolled at every point in time

I can't explain exactly why it works but it has allowed me to solve many problems. That said, I have never seen a Poisson integration work for a problem with a "user-defined" trial limit. For example: "the probability of three matching birthdays in 100 people" could not be solved with integration (to my knowledge). The problem must be in an "over all time / zero to infinity " format. Therefore, these integrations are most commonly used for calculating expected values and "probability of A before B" scenarios
It’s all about making that GTA
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 10th, 2025 at 2:52:45 PM permalink
Quote: Ace2

Kudos to all participants.

As Wizard noted, integral-calculator times out with this one so I used excel to evaluate the integral at these intervals:

1: 89.239
0.1: 88.789
0.01: 88.744
0.001: 88.739
link to original post



Thank you for the problem. Very good. It will definitely make the next "Ask the Wizard" column.

Can you expand on your comment on Excel? I had no idea it could do integration and I consider myself somewhat of an Excel expert.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 10th, 2025 at 3:10:30 PM permalink
Quote: Wizard

Quote: Ace2

Kudos to all participants.

As Wizard noted, integral-calculator times out with this one so I used excel to evaluate the integral at these intervals:

1: 89.239
0.1: 88.789
0.01: 88.744
0.001: 88.739
link to original post



Thank you for the problem. Very good. It will definitely make the next "Ask the Wizard" column.

Can you expand on your comment on Excel? I had no idea it could do integration and I consider myself somewhat of an Excel expert.
link to original post

I wouldn’t say excel does integration, but it makes the calculation easier

In cells A1 - A300 insert values 0-299. In cell B1, insert the formula

((x/365)^2/2 + (x/365) + 1) / e^(x/365))^365

but replace the x’s with a reference to cell A1. Copy B1 down through to B300

The sum of column B will be ~89.2 as you have just numerically integrated that function with a spacing of 1. Use any spacing you like and continue the sum as long as desired. As stated, I saw no reason to go beyond 300 trials and spacing of 0.001 (300k rows at that spacing, clearly converging on 88.74)
It’s all about making that GTA
charliepatrick
charliepatrick
  • Threads: 39
  • Posts: 3052
Joined: Jun 17, 2011
June 10th, 2025 at 3:11:29 PM permalink
Quote: Wizard

Can you expand on your comment on Excel? I had no idea it could do integration and I consider myself somewhat of an Excel expert.

Personally if I was doing it then column A would have
A1 set to the gap between values (e.g. 0.001)
A2 set to the lower bound (e.g. 0)
A3=A2+$A$1
etc down Column A.
In Column B have f(x) (x = value in column A)
In Column C have the approx area of the rectangle e.g $A$1 * (B(n)-B(n-1))
Add up Column C.

You keep going until the total doesn't change that much.
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 10th, 2025 at 3:52:08 PM permalink
Quote: charliepatrick

Quote: Wizard

Can you expand on your comment on Excel? I had no idea it could do integration and I consider myself somewhat of an Excel expert.

Personally if I was doing it then column A would have
A1 set to the gap between values (e.g. 0.001)
A2 set to the lower bound (e.g. 0)
A3=A2+$A$1
etc down Column A.
In Column B have f(x) (x = value in column A)
In Column C have the approx area of the rectangle e.g $A$1 * (B(n)-B(n-1))
Add up Column C.

You keep going until the total doesn't change that much.
link to original post


I would set A2 to the lower bound plus A1 / 2, and just multiply the B values by $A$1 (or just A$1, since the column will never change).
Wizard
Administrator
Wizard
  • Threads: 1528
  • Posts: 27468
Joined: Oct 14, 2009
June 11th, 2025 at 12:41:41 PM permalink
Thanks for the helpful advice on Excel.

Here is my PDF form of the answer to the question at hand as linked to in Ask the Wizard column #420.
"For with much wisdom comes much sorrow." -- Ecclesiastes 1:18 (NIV)
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 11th, 2025 at 1:56:10 PM permalink
Quote: Ace2

Now that we know the expected number of people to get three matching birthdays, what’s the variance?
link to original post

Anybody working on this or shall I post the answer?
It’s all about making that GTA
Ace2
Ace2
  • Threads: 32
  • Posts: 2772
Joined: Oct 2, 2017
June 12th, 2025 at 11:45:13 AM permalink
Quote: Ace2

Now that we know the expected number of people to get three matching birthdays, what’s the variance?
link to original post

To calculate the variance, we need to know the probability of the third match occurring at all points in time. Since f(x) = (((x/365)^2/2 + (x/365) + 1) / e^(x/365))^365 gives us the probability that three matching birthdays have not occurred at any point in time x, the difference between any two points of that function is the probability of occurrence during that interval. The derivative of that function is:

f'(x)= (365*((x/365)^2/2 + x/365 + 1)^365 + (-x-365)*((x/365)^2/2 + x/365 +1)^364)/(e^x *365)

which gives us the rate of change at any point in time. Multiply f'(x) by (x - mean)^2 and integrate over all time:

(365*((x/365)^2/2 + x/365 + 1)^365 + (-x-365)*((x/365)^2/2 + x/365 +1)^364)/(e^x *365) * (x-88.7389)^2 dx

to get the continuous variance of 1,166.72. This figure must be reduced by the expected value of 88.74 to get the discrete variance and final answer of:

1,077.98

Footnotes. Since f'(x) is the probability of the third match happening at point x, integrating it over all time equals 1. Integrating f'(x) * x over all time equals the expected value of 88.74. I got the formula by taking the derivative of my original formula, but there must also be an intuitive way to get it since it can also give the expected value.

Before I thought of taking the derivative, I got the answer by integrating at 0.001 spacing:

((((x/365)^2/2 + (x/365) + 1)/e^(x/365))^365 - ((((x+.001)/365)^2/2 + ((x+.001)/365) +1)/e^((x+.001)/365))^365) * (x - 88.73892)^2 * 1000 dx

This is accurate to six+ digits (1166.72) but will not give the exact answer since it's evaluating the function at specified intervals, whereas the derivative evaluates the function at all points in time

I believe the difference between continuous and discrete variance stems from the the continuous distribution starting at zero versus the discrete distribution starting at one. For instance, if you roll a single die until the number 4 hits, the probability of it never occurring is (5/6)^1 + (5/6)^2 + (5/6)^3 ….=5. You must add (5/6)^0 to get the expected waiting time of 6. Integrating the continuous case gives an expected value of 6 and variance of 36, vs a variance of 30 for the discrete case
Last edited by: Ace2 on Jun 12, 2025
It’s all about making that GTA
KevinAA
KevinAA
  • Threads: 19
  • Posts: 325
Joined: Jul 6, 2017
June 14th, 2025 at 12:31:19 AM permalink
Suppose we have a lottery in which 6 balls are randomly picked in the range of 1 to 54. What is the probability that, in 50 draws, at least 1 ball is not drawn?
AutomaticMonkey
AutomaticMonkey
  • Threads: 10
  • Posts: 596
Joined: Sep 30, 2024
June 14th, 2025 at 2:46:35 AM permalink
Quote: KevinAA

Suppose we have a lottery in which 6 balls are randomly picked in the range of 1 to 54. What is the probability that, in 50 draws, at least 1 ball is not drawn?
link to original post



OK, I'll start with the probability of ball #1 not being drawn on the first draw.

First ball drawn: 53/54 it won't be #1
Second ball drawn: 52/53 it won't be #1
" 51/52
" 50/51
"49/50
"48/49

Looks like .8888888888... probability that ball #1 won't be drawn in that day's lottery. Now what is the probability of ball #1 getting away with that 50 out of 50 times? It's 0.888888...50, or 0.002769325

This is now a one step problem- think of 54 balls, each one having a 0.002769325 chance of being magical! I'm just calling it magical for lack of a better word for "never drawn in 50 trials." So there is a 0.997230675 chance of any ball not being magical. What are the chances of none of them being magical? 0.99723067554, or 0.860922319. 1 minus that is the chance of at least one being magical (never drawn) which is 0.139077681

Did I do that right?
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 14th, 2025 at 7:28:07 AM permalink
Quote: KevinAA

Suppose we have a lottery in which 6 balls are randomly picked in the range of 1 to 54. What is the probability that, in 50 draws, at least 1 ball is not drawn?
link to original post


Here's my solution:

The probability of not drawing a particular ball in one draw is 48 / 54 (yes, I know this reduces to 8/9, but using 48 / 54 makes the rest of the explanation easier), so the probability of not drawing a particular ball in 50 draws is (48 / 54)^50. There are 54 different balls, so the sum of these probabilities is 54 x 48^50 / 54^50 = 48^50 / 50^49.
However, the sum is counting the draws where, say, balls 1 and 2 are both never drawn, twice, so you have to subtract those out. This results in removing the draws where three balls are never drawn one too many times, so add those back, and so on; this is the Inclusion-Exclusion Principle.
The total probability is
48^50 / 54^49
- (48 x 47)^50 / (2! x (54 x 53)^49)
+ (48 x 47 x 46)^50 / (3! x (54 x 53 x 52)^49)
- (48 x 47 x 46 x 45)^50 / (4! x (54 x 53 x 52 x 51)^49)
+ ...
which adds up to about 0.14015, or about once in every 7.135 sets of 50 draws.

KevinAA
KevinAA
  • Threads: 19
  • Posts: 325
Joined: Jul 6, 2017
June 14th, 2025 at 11:53:54 AM permalink
I did a simulation of 1000000 draws and neither are correct.

It seems simple but I am stymied at this. My program gives a result of 0.1399.
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
June 14th, 2025 at 12:36:04 PM permalink
Quote: KevinAA

I did a simulation of 1000000 draws and neither are correct.

It seems simple but I am stymied at this. My program gives a result of 0.1399.
link to original post


I did 20 rounds of 1,000,000 sets of 50 draws, and got these results:
0.140706
0.139873
0.140092
0.140165
0.140625
0.140591
0.140621
0.139872
0.140373
0.140259
0.140191
0.140492
0.140828
0.13978
0.14032
0.139963
0.14019
0.140468
0.140017
0.140504
AutomaticMonkey
AutomaticMonkey
  • Threads: 10
  • Posts: 596
Joined: Sep 30, 2024
June 14th, 2025 at 1:02:18 PM permalink
Quote: ThatDonGuy

Quote: KevinAA

Suppose we have a lottery in which 6 balls are randomly picked in the range of 1 to 54. What is the probability that, in 50 draws, at least 1 ball is not drawn?
link to original post


Here's my solution:

The probability of not drawing a particular ball in one draw is 48 / 54 (yes, I know this reduces to 8/9, but using 48 / 54 makes the rest of the explanation easier), so the probability of not drawing a particular ball in 50 draws is (48 / 54)^50. There are 54 different balls, so the sum of these probabilities is 54 x 48^50 / 54^50 = 48^50 / 50^49.
However, the sum is counting the draws where, say, balls 1 and 2 are both never drawn, twice, so you have to subtract those out. This results in removing the draws where three balls are never drawn one too many times, so add those back, and so on; this is the Inclusion-Exclusion Principle.
The total probability is
48^50 / 54^49
- (48 x 47)^50 / (2! x (54 x 53)^49)
+ (48 x 47 x 46)^50 / (3! x (54 x 53 x 52)^49)
- (48 x 47 x 46 x 45)^50 / (4! x (54 x 53 x 52 x 51)^49)
+ ...
which adds up to about 0.14015, or about once in every 7.135 sets of 50 draws.


link to original post



Interesting! I wonder if the difference between your answer and mine is due to you staying in integers until the end, and me going right to decimals, making it an approximation. I did that on a TI-30 which I think is only 16-bit.
ThatDonGuy
ThatDonGuy
  • Threads: 126
  • Posts: 7128
Joined: Jun 22, 2011
Thanked by
AutomaticMonkey
June 14th, 2025 at 2:35:37 PM permalink
Quote: AutomaticMonkey

Interesting! I wonder if the difference between your answer and mine is due to you staying in integers until the end, and me going right to decimals, making it an approximation. I did that on a TI-30 which I think is only 16-bit.
link to original post


It looks like, when you are multiplying the probabilities of each of the 54 numbers "not being magical" (i.e. it appears at least once in the 50 draws) together, you are counting, for example, draws where both 1 and 2 appear twice - once in the calculation for #1, and again for #2. Once you take those into account, you then have to take into account all of the possible draws where 3 numbers appear, then 4, then 5, and so on.
AutomaticMonkey
AutomaticMonkey
  • Threads: 10
  • Posts: 596
Joined: Sep 30, 2024
June 14th, 2025 at 3:36:28 PM permalink
Quote: ThatDonGuy

Quote: AutomaticMonkey

Interesting! I wonder if the difference between your answer and mine is due to you staying in integers until the end, and me going right to decimals, making it an approximation. I did that on a TI-30 which I think is only 16-bit.
link to original post


It looks like, when you are multiplying the probabilities of each of the 54 numbers "not being magical" (i.e. it appears at least once in the 50 draws) together, you are counting, for example, draws where both 1 and 2 appear twice - once in the calculation for #1, and again for #2. Once you take those into account, you then have to take into account all of the possible draws where 3 numbers appear, then 4, then 5, and so on.
link to original post



Ah OK. I repeated it using my method with a 64-bit calculator and it doesn't diverge from the TI-30 until the 8th decimal place, so it can't be that.

Yeah I guess it's one of those subtle things like the average of the quotients not being the same as the quotient of the averages of the numerators and of the denominators. That problem occurs a lot in metrology and whether or not the error it introduces is acceptable, it all depends.
  • Jump to: