How to resolve the algorithm Harmonic series step by step in the Quackery programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Harmonic series step by step in the Quackery programming language

Table of Contents

Problem Statement

In mathematics, the n-th harmonic number is the sum of the reciprocals of the first n natural numbers: The series of harmonic numbers thus obtained is often loosely referred to as the harmonic series. Harmonic numbers are closely related to the Riemann zeta function, and roughly approximate the natural logarithm function; differing by γ (lowercase Gamma), the Euler–Mascheroni constant. The harmonic series is divergent, albeit quite slowly, and grows toward infinity.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Harmonic series step by step in the Quackery programming language

Source code in the quackery programming language

  [ $ "bigrat.qky" loadfile ] now!
 
  0 n->v
  20 times 
    [ i^ 1+ n->v 1/v v+
      2dup 20 point$ echo$
      say " = " 
      2dup vulgar$ echo$ cr ] 
  2drop
  cr
  1 temp put
  0 n->v 1
  [ dup dip
      [ n->v 1/v v+
       temp share n->v 2over v< ]
    swap if 
      [ temp share echo
        say " : "
        dup echo cr 
        1 temp tally ]
    temp share 11 < while
    1+ 
    again ]
  temp release
  drop 2drop

  

You may also check:How to resolve the algorithm Sorting algorithms/Sleep sort step by step in the Factor programming language
You may also check:How to resolve the algorithm Unix/ls step by step in the Forth programming language
You may also check:How to resolve the algorithm Exceptions/Catch an exception thrown in a nested call step by step in the Objective-C programming language
You may also check:How to resolve the algorithm Rot-13 step by step in the PHP programming language
You may also check:How to resolve the algorithm GUI component interaction step by step in the FutureBasic programming language