The other answers are right and those are formal. Or you can just say "terpikir", it has equivalent meaning. And in informal you can use : kepikir/kepikiran
=Suddenly something comes to my mind ~ Suddenly I think of something
#tiba-tiba aku terpikir/kepikir/kepikiran sesuatu