Guide: Calculating GACHA Odds

#1

Edit: Links should be working now!

Hello everybody,

I just wanted to make a post that has a kind of guide to show how one can guesstimate the odds of a certain type of roll happening.

I can explain the theory behind it but won’t do so unless someone wants to know how this is all calculated. Mostly I just wanted to showcase how you can use WolframAlpha to easily predict the odds of getting a 5 star or multiple 5 stars in a given batch of pulls.
This is also useful if you get crazy lucky and want to know how rare your luck really was.
I hope to update this guide later with more complicated scenarios, but the simple scenario is usually the one that people care about the most.

Without further ado, here we go!

Basic Explanation

So, the math involved here ignores the guaranteed 4+ star and 3+ star cards that are part of a 10-pull. We are treating each pull as an individual pull with the probabilities stated in the summon banner information screen.
The information you need is:

• How many pulls are you doing? (n = number of pulls)
• What is the probability of getting what you are going for (p = probability of success)

So for example, if you have 333 saint quartzes you can do 111 pulls, since it costs 3 per pull. (333/3 = 111 pulls).
So n = 111 in this case.
If you are going for 5 star cards, and the probability of a 5 star is 1%, then p = 0.01
If you are not used to working with decimals, here is a quick guide:
1.00 means 100%,
0.99 is the same as 99%
0.5 is 50%
and so
1% is 0.01
(1 piece out of 100)

The number of “successes” you get when pulling in the gacha is essentially a binomial random variable.
All that really means is you either get a 5 star or you do not. Success or failure, each pull.
I could explain it in more detail, but it really isn’t that important. If you want to know the math behind it let me know and I will write up an explanation, hopefully with pictures.
But that aside, all you really need to know is how to use WolframAlpha.

That should be good for introductions!

Example 1: Odds of At least one 5 * with ~ 333 SQ

Go to WolframAlpha.com and enter in something like in the photo below:

Notice, we type in (note: floor(167*2/3) = 111)
prob x >= 1 for x binomial with n = 111 and p = 0.01
(Note: if you don’t want to calculate the number of pulls just do floor(quartzes / 3)
The above picture is essentially showcasing the odds of getting a 5 star if you buy two 167 SQ packages from the store. 167 sq * 2 / 3 = 111 pulls )

The part that says “For x binomial” just describes the type of probability we are dealing with, which in this case is binomial because we are dealing with a simple Did we succeed? Yes, or no? each time we try, where each try is independent of the other tries.
Don’t worry about what that means too much.

In this example we find out that we have a 67% chance of getting at least one 5 star.
That also includes the possibility of getting more than one 5 star, but that is also a good scenario.
Not too shabby, eh? but still, that is a lot of SQ.
But this can help you decide if you want to go for that husbandu or not, although you never know how lucky or unlucky you may end up being, nothing is guaranteed.

Let’s do another example.

Example 2: Probability of getting five 5* CEs with ~99 SQ

Let’s say you want to know the odds of getting five 5* craft essences from the Okita Souji banner, and you have 100 saint quartzes saved up.
That is floor(100/3) = 33 pulls. (33 * 3 = 99 with 1 SQ left over.
You can’t do a fraction of a pull, so we use the floor function to get an integer number.

The probability of getting a 5 star craft essence is 4%.
So now we have n = 33 and p = 0.04.
So now we would type in,
prob x >= 5 for x binomial with n = 33 and p = 0.04

The probability of getting at least 5 five star craft essences in 33 pulls is about 0.95%.
So roughly 1%.
This of course does not account for the fact that these 5 star CEs might all be different, ruining your dreams of MLBing a specific CE.

But anyway, this is an easy way to kind of get a rough estimate of the odds of your success.
In banners where the servant is sharing the banner with another servant you will want to replace the 0.01 with the appropriate probability based on the split.
Actually, you should do that anyway if you are going for a specific servant.
For example, in the Okita banner you have a 0.7 percent chance of getting Okita, so you should have p = 0.007 in your calculations for more accuracy, if you are only focusing on the probability of pulling Okita.

Comparing the Odds of NP1, NP2,..., NP5 and the number of pulls to get X% chance
The x-axis is the # of pulls. In this example I had it go from 1 pull all the way up to 500 pulls.
The y-axis is the probability of getting NP1, NP2, NP3, NP4, NP5. (well, really it is the probability of getting that # of 5 stars, since I used the flat 1% probability in this example)

You can just ignore the legend on the right side of the map, I haven’t figured out how to relabel it yet.

The top curve is the NP1 curve, which makes sense because it is much easier to reach NP1 than NP5.
And the curves follow from the top to the bottom, going from NP1, NP2, NP3, down to the smallest curve of NP5.
You can see from the curve that it takes 500 pulls, or 1500 quartz to get about a 54% chance of NP5ing a given servant.

You cannot zoom in or click to figure out what each point is exactly without a pro account, but I have written a script to help alleviate that somewhat.

I finally finished the script, so I will describe it briefly here.
It is a javascript bookmarklet, which means you save it as a bookmark and then click it to run the code on wolfram-alpha.com.

You have to manually calibrate it by putting your cursor in the top-left part of the graph, pressing w, and then putting your cursor in the bottom right corner of the graph and pressing s.
It assumes the graph has a width of 500, but you can change this by using the adjust width field and button.
(i.e. if you wanted to run a query with 1000 instead of 500 pulls as the max)

If you run a new query after clicking the bookmarklet, then you will have to click the “resync” button to make the program work again.

My github repo for the code

For now this gives you a rough tool to compare the odds of getting NPX given any arbitrary number of pulls.
I’ll try to update this section again sometime to clean it up and make it more readable.
Don’t hesitate to message me with any questions ^ _ ^

Getting a feel for the odds of getting NP1, NP2, etc given the # of SQ you have saved

The idea here is that you know you have say 100 saint quartzes saved up, and you just want to know what is the likelihood that you get the servant you want to NP1, NP2, NP3, etc with this amount of SQ.
This could be useful if you actually have a large stock and are debating using slightly more if it improves the odds enough for you to be tempted.
Of course, the gacha can be fierce, so don’t let your guard down too much.

Here are the queries:
For the table:
N[Table[prob x >= j for x binomial with n = 100 and p = 0.01, {j, 5} ]]

Just remember to change n in each query to the number of pulls you are looking at doing.
That should be the number of SQ you plan to spend divided by 3, but a whole number.
(For those who want to know)
And change p to reflect what you are hoping to get.
p should really be 0.007 in the above examples if you are going for Okita, for example.

If anyone has any feedback or corrections to things I missed or requests please don’t hesitate to let me know.
I am not an expert, but I wanted to share this useful tool. It scratches a certain itch that is satisfying to scratch.
Anyway, thanks for reading, and may the Gacha gods bless your pulls! ~( ^ _ ^ )~

How much SQ to save?
#2

Very good work! It’s shocking how \$500 only get you 7/8 odds on guranteed 5*.

#3

Thanks! ^ _ ^
Yeah, it is a very strict gacha lol. OTL
But it makes the times you succeed feel really awesome, although not succeeding is heartbreaking @[email protected]

#4

This raises an interesting question:

Is there a wolfram alpha query that graphs trials against probability? As in, a graph that charts how many rolls versus your chance of getting NP1+, NP2+, etc?

#5

Hmm, good question. I will try to look into it, as I am not sure.
Yes!

Edit: I have included a different approach more in line with the desired graph in the relevant section of the original post.
I have also included the techniques below in their own section in the original post along with hyperlinks and a little bit of extra text.
I am leaving them in this reply for historical reasons.

Original response (see main post for alternative technique w/o fixing the number of pulls)

We can do this. However, I would recommend plotting it and generating a table, as the plot is hard to read without a pro account (because apparently you are not allowed to zoom in or enlarge the graph without a pro account)
But no matter, combining it with a table makes it super sick.

Here are the queries:
For the table:
N[Table[prob x >= j for x binomial with n = 100 and p = 0.01, {j, 5} ]]

For the graph:
DiscretePlot[prob x >= j for x binomial with n = 100 and p = 0.01, {j, 1, 5} ]

Just remember to change n in each query to the number of pulls you are looking at doing.
That should be the number of SQ you plan to spend divided by 3, but a whole number.
(For those who want to know)
And change p to reflect what you are hoping to get.
p should really be 0.007 in the above examples if you are going for Okita, for example.

#6

I always forget how powerful Wolfram Alpha is if you just use the right queries. Good posts.

#7

Thank you :)
I used Wolfram Mathematica in my Cryptography class at school, so it just made a whole lot of sense to do this lol

Single or 10 pull?
#8

That attempt versus probability of getting NP1, NP2, etc. query is absolutely brilliant! Something I been dreaming about for a long time, but just couldn’t figure out how to resolve without a bit of grunt work.

query for single 5* rateup

Is it me, or there appears to be a point of diminishing returns for these curves? There seem to be a sweetspot of around 200 rolls for NP1?

#9

Analyzing NP2+ is going to be a bit harder, since it doesn’t have a simple closed form, but I think I figured out the NP1 sweetspot.

So it appears the sweetspot is 143 pulls 5* rateup!

Interestingly, sweetspot pull can be solved as -1/ln(1-p).

Hypothesis: sweetspot is x where P(x) = 1 - 1/e for NP2, NP3, and any NPJ as well.