Shulchan Arukh, Orach Chayim Siman 344
Can copy this into an AI, or connect the whole library to your assistant. For deeper learning, you can directly use the original seforim, sites, and apps.
ההולך במדבר ואינו יודע מתי הוא שבת מונה שבעה ימים מיום שנתן אל לבו שכחתו ומקדש השביעי בקידוש והבדלה ואם יש לו ממה להתפרנס אסור לו לעשות מלאכה כלל עד שיכלה מה שיש לו ואז יעשה מלאכה בכל יום אפילו ביום שמקדש בו כדי פרנסתו מצומצמת ומותר לילך בו בכל יום אפי' ביום שמקדש בו:
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.
היה יודע מנין יום שיצא בו כגון שיודע שהיום יום רביעי או יום חמישי ליציאתו אבל אינו יודע באיזו יום יצא מותר לעשות מלאכה כל מה שירצה ביום שמיני ליציאתו שביום כזה יצא מביתו דבודאי לא יצא בשבת וכן ביום ט"ו וביום כ"ב וכן לעולם:
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.