Scratch Computing Algorithm