How to resolve the algorithm Sisyphus sequence step by step in the Phix programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sisyphus sequence step by step in the Phix programming language

Table of Contents

Problem Statement

The Sisyphus sequence is an infinite sequence of positive integers that was devised in 2022 by Eric Angelini and Carole Dubois. The first term is 1. Subsequent terms are found by applying the following rule: 1 is odd and so the second term is: 1 + 2 = 3, because 2 is the smallest prime not yet added. 3 is odd and so the third term is: 3 + 3 = 6, because 3 is the smallest prime not yet added. 6 is even and so the fourth term is : 6 ÷ 2 = 3, and so on. Find and show on this page (in 10 lines of 10 terms), the first 100 terms of the sequence. What are the 1,000th, 10,000th, 100,000th and 1,000,000th terms of the sequence and, in each case, what is the highest prime needed to reach them? If it is difficult or impossible for your language or output device to meet all of these requirements, then just do what you reasonably can. What are the 10 millionth and 100 millionth terms and the highest prime needed to reach each one? By the time the 100 millionth term is reached, which number(s) under 250:

What is the number of the first term to equal 36? This was originally set as a challenge by Neil Sloane who was worried by its non-appearance and found by Russ Cox.

Let's start with the solution: