implemented a simple rule30 function