Integer26. The days of the week are numbered as follows: 1 - Monday, 2 - Tuesday, ..., 6 - Saturday, 7 - Sunday. 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 January 1 was Tuesday.

Solution in Python 3:

import random

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

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

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

i = K%7 + 1
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])