The Law of Someone Who Is Wandering in the Desert on Shabbat, 2 Seifim: 1. One who is wandering in the desert and does not when is Shabbat, counts seven days from the day he realized he did not know, and sanctifies the seventh day with Kiddush and Havdalah. If one has sustenance, one is forbidden from doing any work whatsoever until he uses what he has, and thereafter one should do work each day, even on the day he sanctifies, to achieve minimal sustenance. One is permitted to walk every day, even on the day he sanctifies.
2. If he knows how many days he has been walking, i.e. he knows that today is the fourth day or the fifth day since his departure, but he does not know on which day he left, he is permitted to do as much work as he wants on the eighth day since his departure, because on that day of the week he left his house, and he certainly did not leave on Shabbat, and so too on the fifteenth day and the twenty-second day, and so on.