Caviare, it isn't an algorithm, because it doesn't necessarily finish. Essentially what you are doing is the same as me, but instead of allowing up to 5 tosses of the coin, you allow infinitely many, which works, but for the fact that it can take forever (and at least a very long time).
I essentially used your method, but approximated:
2/3 = 0.10101 (base 2)
And that way, after five flips (1, 0, 1, 0, 1) You know it will end on a 1, so don't have to do the flipping (so you can stop for certain, and it is a genuine algorithm.