1. A non-transitory computer-readable recording medium storing therein an encoding program that causes a computer to execute a process comprising: encoding, within compression target data, each part with a sequence of a same value into a count of consecutive runs of the value; decomposing the count of consecutive runs of the value into an addition of integers belonging to a predetermined integer group; calculating a probability of occurrence of each of the integers obtained by the decomposing; and encoding each of the integers by assigning a shorter code to an integer with a higher probability of occurrence.