How to resolve the algorithm Primes: n*2^m+1 step by step in the Raku programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Primes: n*2^m+1 step by step in the Raku programming language

Table of Contents

Problem Statement

A050921 - Smallest prime of form n*2^m+1

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Primes: n*2^m+1 step by step in the Raku programming language

Source code in the raku programming language

-> $n { (^∞).map: -> $m { if (my $p = $n × 2 ** $m + 1).is-prime { printf "%3d %4d: %d\n",$n,$m,$p; last } } } for 1..400


  

You may also check:How to resolve the algorithm Price fraction step by step in the REXX programming language
You may also check:How to resolve the algorithm Nested function step by step in the REXX programming language
You may also check:How to resolve the algorithm Mandelbrot set step by step in the MySQL programming language
You may also check:How to resolve the algorithm Set step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Terminal control/Display an extended character step by step in the ACL2 programming language