Question solved by bitcoin miners
If you want a bitcoin miner of your own, don't reinvent the wheel and instead use efficient software. You're wasting your time if you aren't mining with ASICs anyways.

I like to think of mining Bitcoins as a way of bruteforcing SHA-256. Basically the difficulty of the Bitcoin network determines how long it should take the total computing power of the entire Bitcoin network to brute force or 'guess' the input to a SHA-256 function. By making the input sufficiently complex, the Bitcoin network can control how often new blocks are awarded. This concept decentralizes the currencies by enforcing a proof of work system. It comes down to the math behind computing algorithms and time.