How to resolve the algorithm Taxicab numbers step by step in the Ring programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Taxicab numbers step by step in the Ring programming language

Table of Contents

Problem Statement

A   taxicab number   (the definition that is being used here)   is a positive integer that can be expressed as the sum of two positive cubes in more than one way.

The first taxicab number is   1729,   which is:

Taxicab numbers are also known as:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Taxicab numbers step by step in the Ring programming language

Source code in the ring programming language

# Project : Taxicab numbers

num = 0
for n = 1 to 500000
    nr = 0
    tax = []
    for m = 1 to 75
        for p = m + 1 to 75
            if n = pow(m, 3) + pow(p, 3)
               add(tax, m)
               add(tax, p)
               nr = nr + 1
            ok
        next
    next
    if nr > 1
       num = num + 1
       see "" + num + " " + n + " => " + tax[1] + "^3 + " + tax[2] + "^3" + ", "
       see "" + tax[3] + "^3 +" + tax[4] + "^3" + nl
       if num = 25
          exit
       ok
    ok
next
see "ok" + nl

  

You may also check:How to resolve the algorithm Trigonometric functions step by step in the МК-61/52 programming language
You may also check:How to resolve the algorithm Gamma function step by step in the zkl programming language
You may also check:How to resolve the algorithm Rendezvous step by step in the Racket programming language
You may also check:How to resolve the algorithm Topological sort step by step in the zkl programming language
You may also check:How to resolve the algorithm HTTPS/Client-authenticated step by step in the Arturo programming language