How to resolve the algorithm Yellowstone sequence step by step in the PicoLisp programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Yellowstone sequence step by step in the PicoLisp programming language
Table of Contents
Problem Statement
The Yellowstone sequence, also called the Yellowstone permutation, is defined as: For n <= 3, For n >= 4,
The sequence is a permutation of the natural numbers, and gets its name from what its authors felt was a spiking, geyser like appearance of a plot of the sequence.
a(4) is 4 because 4 is the smallest number following 1, 2, 3 in the sequence that is relatively prime to the entry before it (3), and is not relatively prime to the number two entries before it (2).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Yellowstone sequence step by step in the PicoLisp programming language
Source code in the picolisp programming language
(load "@lib/frac.l")
(de yellow (N)
(let (L (list 3 2 1) I 4 C 3 D)
(while (> N C)
(when
(and
(not (idx 'D I))
(=1 (gcd I (get L 1)))
(> (gcd I (get L 2)) 1) )
(push 'L I)
(idx 'D I T)
(setq I 4)
(inc 'C) )
(inc 'I) )
(flip L) ) )
(println (yellow 30))
You may also check:How to resolve the algorithm Babbage problem step by step in the VBA programming language
You may also check:How to resolve the algorithm Enforced immutability step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Zero to the zero power step by step in the Oforth programming language
You may also check:How to resolve the algorithm Church numerals step by step in the Typed Racket programming language
You may also check:How to resolve the algorithm Numbers which are the cube roots of the product of their proper divisors step by step in the Haskell programming language