How to resolve the algorithm Composite numbers k with no single digit factors whose factors are all substrings of k step by step in the Arturo programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Composite numbers k with no single digit factors whose factors are all substrings of k step by step in the Arturo programming language

Table of Contents

Problem Statement

Find the composite numbers k in base 10, that have no single digit prime factors and whose prime factors are all a substring of k.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Composite numbers k with no single digit factors whose factors are all substrings of k step by step in the Arturo programming language

Source code in the arturo programming language

valid?: function [n][
    pf: factors.prime n
    every? pf 'f ->
        and? [contains? to :string n to :string f]
             [1 <> size digits f]
]

cnt: 0
i: new 3

while [cnt < 10][
    if and? [not? prime? i][valid? i][
        print i
        cnt: cnt + 1
    ]
    'i + 2
]


  

You may also check:How to resolve the algorithm Call an object method step by step in the C++ programming language
You may also check:How to resolve the algorithm Hickerson series of almost integers step by step in the C++ programming language
You may also check:How to resolve the algorithm Multiple regression step by step in the Tcl programming language
You may also check:How to resolve the algorithm Sum to 100 step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the REXX programming language