Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28493 views
License: GPL3
ubuntu2004
Function: _forcomposite_init
Class: gp2c_internal
Help: Initialize forcomposite_t.
Description:
 (forcomposite,int):void                  forcomposite_init(&$1, $2, NULL)
 (forcomposite,int,?int):void             forcomposite_init(&$1, $2, $3)

Function: _forcomposite_next
Class: gp2c_internal
Help: Compute the next composite.
Description:
 (forcomposite):int                       forcomposite_next(&$1)

Function: forcomposite
Section: programming/control
C-Name: forcomposite
Prototype: vV=GDGI
Help: forcomposite(n=a,{b},seq): the sequence is evaluated, n running over the
 composite numbers between a and b. Omitting b runs through composites >= a.
Iterator:
 (gen,gen,?gen) (forcomposite, _forcomposite_init, _forcomposite_next)
Doc: evaluates \var{seq},
 where the formal variable $n$ ranges over the composite numbers between the
 nonnegative real numbers $a$ to $b$, including $a$ and $b$ if they are
 composite. Nothing is done if $a>b$.
 \bprog
 ? forcomposite(n = 0, 10, print(n))
 4
 6
 8
 9
 10
 @eprog\noindent Omitting $b$ means we will run through all composites $\geq a$,
 starting an infinite loop; it is expected that the user will break out of
 the loop himself at some point, using \kbd{break} or \kbd{return}.

 Note that the value of $n$ cannot be modified within \var{seq}:
 \bprog
 ? forcomposite(n = 2, 10, n = [])
  ***   at top-level: forcomposite(n=2,10,n=[])
  ***                                      ^---
  ***   index read-only: was changed to [].
 @eprog