How to resolve the algorithm Sum of a series step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sum of a series step by step in the PicoLisp programming language

Table of Contents

Problem Statement

Compute the   nth   term of a series,   i.e. the sum of the   n   first terms of the corresponding sequence.
Informally this value, or its limit when   n   tends to infinity, is also called the sum of the series, thus the title of this task. For this task, use:

This approximates the   zeta function   for   S=2,   whose exact value is the solution of the Basel problem.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sum of a series step by step in the PicoLisp programming language

Source code in the picolisp programming language

(scl 9)  # Calculate with 9 digits precision

(let S 0
   (for I 1000
      (inc 'S (*/ 1.0 (* I I))) )
   (prinl (round S 6)) )  # Round result to 6 digits

  

You may also check:How to resolve the algorithm System time step by step in the Jsish programming language
You may also check:How to resolve the algorithm Long primes step by step in the Picat programming language
You may also check:How to resolve the algorithm Combinations with repetitions step by step in the TXR programming language
You may also check:How to resolve the algorithm Jaro similarity step by step in the Sidef programming language
You may also check:How to resolve the algorithm Sequence: smallest number greater than previous term with exactly n divisors step by step in the MiniScript programming language