Groups with twisted p-periodic cohomology