Suppose p is odd. Then the average of the integers is the middle number, which is some integer n. Then the sum of the p consecutive integers is p times n, where p is an odd integer and n is any other integer.
Since the given sum 4 can't be written as the product of two integers of which at least one is odd, we now the number of integers p can't be odd.
So p must be even. Then the average of the integers is halfway between two integers; call that average n+1/2, where n is n integer. Then the sum of the integers is the product of the even number p and the number (n+1/2).
The only way to write the given sum 4 in the form p(n+1/2) where p and n are both integers is 8(1/2).
That means the integers are the 8 integers with an average of 1/2.
So the answer to the question is p=8.
The 8 integers are the 4 integers either side of 1/2: 0, -1, -2, and -3; and 1, 2, 3, and 4.