[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Given a random string of n digits, what's the chance you

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 15
Thread images: 2

File: 1425334918222.jpg (148KB, 800x800px) Image search: [Google]
1425334918222.jpg
148KB, 800x800px
Given a random string of n digits, what's the chance you can assign a plus or minus to each of them such that they add up to 9?

Ex: 144741 -> (-1) + (-4) + 4 + 7 + 4 + (-1) = 9
>>
>combinatorics
blegh
>>
File: 1434913126048.png (129KB, 413x477px) Image search: [Google]
1434913126048.png
129KB, 413x477px
Here's an idea to get you started: If all digits are even, then it's easy to see that it's impossible to sum them up to 9. If all digits are odd, then it depends on the parity of n: Adding or subtracting two odd numbers always gives you an even number, so if n is even and all numbers are odd, then it's not possible to sum them up to 9. More generally, if you don't have an odd number of odd digits, then it's not possible to get 9.

Another observation is that if you have any set of digits that can be summed up to 0 in some way, then flipping the sign on any of them will always change the sum by a multiple of two (changing a -1 to a 1 will change the sum from 0 to 2, for example) so combining groups of numbers that can be summed up to two, you will never get an odd sum out of them.
>>
>>8935004
More generally, if their sum is even, then it is not possible, so the probability is surely smaller than 0.5
>>
>>8934964

Lol try the following n=1 string:

6

NIGGER
>>
>>8935310

Whoops, "what are the chances".

Turns out I was the nigger all along!
>>
Some numerical results. All of these are out of 10^n.

0 0
1 1
2 10
3 164
4 2512
5 34327
6 415508

code:
https://pastebin.com/7A4CLCSA
>>
>>8934964

sqrt(2)-1 what do I win.
>>
>>8935320
Oh shit, I forgot to actually store the results in the cache, no wonder it was running so slow.
https://pastebin.com/4JSbmfZ8

0 0
1 1
2 10
3 164
4 2512
5 34327
6 415508
7 4597280
>>
>>8935352
More optimization, avoiding actually looping over the redundant entries:
https://pastebin.com/cR3LNhQQ

0 0
1 1
2 10
3 164
4 2512
5 34327
6 415508
7 4597280
8 48249704
9 492893895
10 4972527466
11 49897215437
12 499622501752
13 4998621537861
>>
>>8934964
The real question here is - would you do that fairy /sci/?
>>
If the digits have a subset that reaches all odd numbers -9...+9 or all even numbers -8...+8, then a straightforward inductive argument shows that they also reach all odds -9...+9 or evens -8...+8. For large n, it's likely that you'll have such a subset. The cases to focus on are the sets of digits that don't reach all of either odds -9...+9 or evens -8...+8.
>>
Isn't this just the partition problem?
>>
>>8935403

It seems to approach .5, which makes sense intuitively. As the number of digits increases, you have very many more options to get 9 as long as you don't have an even sum, which will happen half the time, with a "few" stray cases where you can't get 9 with an odd sum.
>>
>>8935767
I agree that it should go to 1/2. try to prove it though
Thread posts: 15
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.