Maxima branch_5_49_base_416_g162a6093a https://maxima.sourceforge.io using Lisp SBCL 2.6.0.debian Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. | ||||||
|---|---|---|---|---|---|---|
| %i1 | liste_nombres_premiers(
n):=(s:[],
for k from 2 thru n do
if primep(k) then s:append(s,[k]),s)
|
liste_nombres_premiers(n):=(s:[], for k from 2 thru n do (if primep(k) then s:append(s,[k])),s)$ |
((MDEFINE SIMP) (($LISTE_NOMBRES_PREMIERS) $N) ((MPROGN) ((MSETQ) $S ((MLIST))) ((MDO) $K 2 NIL NIL $N NIL ((MCOND) (($PRIMEP) $K) ((MSETQ) $S (($APPEND) $S ((MLIST) $K))) T $FALSE)) $S)) | |||
| %i2 | nombre_nombres_premiers(
n):=(j:0,
for i from 2 thru n do
if primep(i) then j:j+1,j)
|
nombre_nombres_premiers(n):=(j:0, for i from 2 thru n do (if primep(i) then j:j+1),j)$ |
((MDEFINE SIMP) (($NOMBRE_NOMBRES_PREMIERS) $N) ((MPROGN) ((MSETQ) $J 0) ((MDO) $I 2 NIL NIL $N NIL ((MCOND) (($PRIMEP) $I) ((MSETQ) $J ((MPLUS) $J 1)) T $FALSE)) $J)) | |||
| %i3 | liste_nombres_premiers(50) |
liste_nombres_premiers(50); |
(($LISTE_NOMBRES_PREMIERS SIMP) 50) | |||
| %o3 | [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] |
|||||
| %i4 | nombre_nombres_premiers(50) |
nombre_nombres_premiers(50); |
(($NOMBRE_NOMBRES_PREMIERS SIMP) 50) | |||
| %o4 | 15 |
|||||
| %i5 | nombre_nombres_premiers(100000) |
nombre_nombres_premiers(100000); |
(($NOMBRE_NOMBRES_PREMIERS SIMP) 100000) | |||
| %o5 | 9592 |
|||||
| %i6 | plot2d(['(float(nombre_nombres_premiers(
x))),x/log(x),
'(romberg(1/log(t),t,2,x))],
[x,20,500],[y,0,500])
|
plot2d(['(float(nombre_nombres_premiers(x))),x/log(x),'(romberg(1/log(t),t,2,x))],[x,20,500],[y,0,500]); |
((|$plot2d| . #1=(SIMP)) ((MLIST . #1#) ((MQUOTE . #1#) (($FLOAT . #1#) (($NOMBRE_NOMBRES_PREMIERS SIMP) $X))) ((MTIMES . #1#) $X (#2=(MEXPT . #1#) ((%LOG SIMP) $X) -1)) ((MQUOTE . #1#) (($ROMBERG . #1#) (#2# ((%LOG SIMP) $T) -1) $T 2 $X))) ((MLIST SIMP) $X 20 500) ((MLIST SIMP) $Y 0 500)) | |||
| %o6 | plot2d |
|||||
Yamwi Source
Yamwi version: 2026-04-29Validate