these seem correct to me but with two starting assumptions:

1. there are no fees

2. you are buying the same amount on each price.

to add the fees you have to calculate them for each purchase and sale and add it to your final price calculation which means you have to sell at a little bit higher price than what you were calculating before to cover the fees.

also if you buy for example 1

BTC at first price, 0.5

BTC, 2

BTC, 0.0001

BTC on the rest then you have invested $38150.59 and selling at 9000 (price sum/4) would give you $31500.9 but if you buy 1

BTC at each price you will invest 36000 and selling gives you 36000 (assuming fees are zero).

to solve this the formula is this:

sell price = total_amount_invested / total_bitcoin_you_bought

in this case sell break even price would be $10899.85