How to resolve the algorithm Cullen and Woodall numbers step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Cullen and Woodall numbers step by step in the Quackery programming language
Table of Contents
Problem Statement
A Cullen number is a number of the form n × 2n + 1 where n is a natural number. A Woodall number is very similar. It is a number of the form n × 2n - 1 where n is a natural number. So for each n the associated Cullen number and Woodall number differ by 2. Woodall numbers are sometimes referred to as Riesel numbers or Cullen numbers of the second kind.
Cullen primes are Cullen numbers that are prime. Similarly, Woodall primes are Woodall numbers that are prime. It is common to list the Cullen and Woodall primes by the value of n rather than the full evaluated expression. They tend to get very large very quickly. For example, the third Cullen prime, n == 4713, has 1423 digits when evaluated.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Cullen and Woodall numbers step by step in the Quackery programming language
Source code in the quackery programming language
[ dup << 1+ ] is cullen ( n --> n )
[ dup << 1 - ] is woodall ( n --> n )
say "First 20 Cullen numbers:" cr
20 times [ i^ 1+ cullen echo sp ] cr
cr
say "First 20 Woodall numbers:" cr
20 times [ i^ 1+ woodall echo sp ] cr
You may also check:How to resolve the algorithm Read entire file step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Shortest common supersequence step by step in the C# programming language
You may also check:How to resolve the algorithm Loops/With multiple ranges step by step in the Phix programming language
You may also check:How to resolve the algorithm Check that file exists step by step in the Erlang programming language
You may also check:How to resolve the algorithm Sum and product of an array step by step in the Go programming language