On periodic mod p sequences