How to resolve the algorithm Cullen and Woodall numbers step by step in the FutureBasic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Cullen and Woodall numbers step by step in the FutureBasic 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 FutureBasic programming language
Source code in the futurebasic programming language
local fn CullenAndWoodall( limit as long )
NSUInteger i, cullen, woodall
printf @"%13s %9s", fn StringUTF8String( @"Cullen" ), fn StringUTF8String( @"Woodall" )
for i = 1 to limit
cullen = i * ( 2^i ) + 1
woodall = i * ( 2^i ) - 1
printf @"%3lu %9lu %9lu", i, cullen, woodall
next
end fn
fn CullenAndWoodall( 20 )
HandleEvents
You may also check:How to resolve the algorithm Empty program step by step in the Genyris programming language
You may also check:How to resolve the algorithm Null object step by step in the MAXScript programming language
You may also check:How to resolve the algorithm Execute HQ9+ step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Parsing/RPN calculator algorithm step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Loops/Break step by step in the Emacs Lisp programming language