what you are looking for is modulo option. In my example scene file is input set from 0 to 1 which means for FPS 30 frames (defined in project setings) values from 1 to 4 count just one time (1-2-3-4 in 30 frames)
If you want faster counting, decrease input outer value. (in case set 0,5 instead of 1, numbers from 1 to 4 will be counted in 15 frames (since it is half of range,in case set 0,333 instead of 1, numbers from 1 to 4 will be counted in 10 frames, what is 1/3 of FPS 30frames)
https://www.dropbox.com/s/u8ss36hgnb1pfzb/NumberLogic_0001.zip?dl=0