Provide number of iteration via command line
Replace sum function with more efficient version from samples