How to resolve the algorithm Sequence: smallest number greater than previous term with exactly n divisors step by step in the Factor programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sequence: smallest number greater than previous term with exactly n divisors step by step in the Factor programming language

Table of Contents

Problem Statement

Calculate the sequence where each term an is the smallest natural number greater than the previous term, that has exactly n divisors.

Show here, on this page, at least the first 15 terms of the sequence.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sequence: smallest number greater than previous term with exactly n divisors step by step in the Factor programming language

Source code in the factor programming language

USING: io kernel math math.primes.factors prettyprint sequences ;

: next ( n num -- n' num' )
    [ 2dup divisors length = ] [ 1 + ] do until [ 1 + ] dip ;

: A069654 ( n -- seq )
    [ 2 1 ] dip [ [ next ] keep ] replicate 2nip ;

"The first 15 terms of the sequence are:" print 15 A069654 .


  

You may also check:How to resolve the algorithm EKG sequence convergence step by step in the Sidef programming language
You may also check:How to resolve the algorithm Babbage problem step by step in the Transd programming language
You may also check:How to resolve the algorithm Determine if a string has all the same characters step by step in the Lambdatalk programming language
You may also check:How to resolve the algorithm Successive prime differences step by step in the Arturo programming language
You may also check:How to resolve the algorithm Pointers and references step by step in the Delphi programming language