Integer25. The days of the week are numbered as follows: 0 - Sunday, 1 - Monday, 2 - Tuesday, ..., 6 - Saturday. Given an integer K, lying in the range 1-365. Determine the number of the day of the week for the K-th day of the year, if it is known that this year on January 1 was Thursday.

Solution in Python 3:

import random

week_days = {
0: 'Sunday',
1: 'Monday',
2: 'Tuesday',
3: 'Wednesday',
4: 'Thursday',
5: 'Friday',
6: 'Saturday'
}

K = random.randrange(1,366)
K = 31

i = (1+3)%7
print("January, 1: ", 1)
print("Number of the day of the week: ", i)
print("Day of the week:",week_days[i])

i = (K+3)%7
print()
print("Number of the day of the year: ", K)
print("Number of the day of the week: ", i)
print("Day of the week:",week_days[i])