### Related

##### block-inv_mod-print-while

block( r:1, p:97...

Calculate

##### if-or-plot2d

f(x):=if (x<0)or(x...

plot2d(f(x),[x,-1,3]);

Calculate

second(first(first(ls...

Calculate

p:next_prime(13453531);

a:46515611;

Calculate

##### next_prime-totient

q1:next_prime(7846564...

q2:next_prime(44468468);

q:q1*q2;

Calculate

##### if-plot2d

(E:2.1*1e11, Iy:171*1...

w1: (-1/E*Iy)*((-FA+q...

w2: (-1/E*Iy)*((-FA-F...

Calculate

##### if-plot2d

(E:1, Iy:1, FB:1, q:1...

w1: (-1/(E*Iy))*((-FA...

w2: (-1/(E*Iy))*((-FA...

Calculate

##### next_prime

next_prime( 999999999...

Calculate

##### if-lambda-let

:lisp (defvar *my-lis...

:lisp (defun levels (...

:lisp (levels *my-lis...

Calculate

##### if-let

:lisp (defvar *my-lis...

:lisp (defun levels (...

:lisp (levels *my-lis...

Calculate

### [append,ascii,block,delete,first,if,make_random_state,next_prime,sconcat,second,set_random_state,slength,substring,true]

Run Example
```(%i1)SEMICOL:ascii(59);
(%o1)                                  ;
(%i2) MAXEX:800;
(%o2)                                 800
(%i3) MX_STEPS:15;
(%o3)                                 15
(%i4) set_random_state(make_random_state(true));
(%o4)                                done
(%i5) get_number_from_list_old(P):=(s:1,for i in P do s:s*first(i)^second(i),s);
(%o5) get_number_from_list_old(P) := (s : 1,
second(i)
for i in P do s : s first(i)         , s)
(%i6) get_number_from_list(P):=(s:1,for i in P do s:s*first(i)^second(i),s:s*Num1^Exp1*Num2^Exp2,s);
(%o6) get_number_from_list(P) := (s : 1,
second(i)            Exp1     Exp2
for i in P do s : s first(i)         , s : s Num1     Num2    , s)
(%i7) divsum2(P):=(s:1,for i in P do s:s*(first(i)^(second(i)+1)-1)/(first(i)-1),s);
second(i) + 1
s (first(i)              - 1)
(%o7) divsum2(P) := (s : 1, for i in P do s : -----------------------------, s)
first(i) - 1
(%i8) write_number_from_list(P):=(s:"1",for i in P do s:sconcat(s,"*",first(i),"^",second(i)),s);
(%o8) write_number_from_list(P) := (s : "1",
for i in P do s : sconcat(s, "*", first(i), "^", second(i)), s)
(%i9) write_povol_from_list(Pov):=(s:"",for i in Pov do s:sconcat(s,",",i),s);
(%o9) write_povol_from_list(Pov) := (s : "",
for i in Pov do s : sconcat(s, ",", i), s)
(%i10) create_number_from_list(P,name):=(s:sconcat(name,":[]",SEMICOL," "),for i in P do s:sconcat(s,name,":append(",name,",[[",first(i),",",second(i),"]])",SEMICOL," "),s);
(%o10) create_number_from_list(P, name) :=
(s : sconcat(name, ":[]", SEMICOL, " "),
for i in P do s : sconcat(s, name, ":append(", name, ",[[", first(i), ",",
second(i), "]])", SEMICOL, " "), s)
(%i11) create_number_from_list2(P,name):=(s:aconcat(name,":["),for i in P do s:sconcat(s,"[",first(i),",",second(i),"],"),s:substring(s,1,slength(s)),s:sconcat(s,"]",SEMICOL),s);
(%o11) create_number_from_list2(P, name) :=
(s : aconcat(name, ":["), for i in P do s :
sconcat(s, "[", first(i), ",", second(i), "],"),
s : substring(s, 1, slength(s)), s : sconcat(s, "]", SEMICOL), s)
(%i12) is_deffic(P):=block(n:get_number_from_list(P), if (divsum(n) <
2*n) then return (1) else return (0));
(%o12) is_deffic(P) := block(n : get_number_from_list(P),
if divsum(n) < 2 n then return(1) else return(0))
(%i13) deffic(P):=block(n:get_number_from_list(P), divsum(n)/(2*n));
divsum(n)
(%o13)    deffic(P) := block(n : get_number_from_list(P), ---------)
2 n
(%i14) nastav_povol(P):=(P2:[], j:1, for i in P do (P2:append(P2,[j]),j:j+1),P2);
(%o14) nastav_povol(P) := (P2 : [], j : 1,
for i in P do (P2 : append(P2, [j]), j : j + 1), P2)
(%i15) najdi_index(Pov):=(random(length(Pov))+1);
(%o15)            najdi_index(Pov) := random(length(Pov)) + 1
(%i16) zvets(P,k):=(P[k][2]:MAXEX);
(%o16)                   zvets(P, k) := (P )  : MAXEX
k
2
(%i17) zvets_o1(P,k):=(P[k][2]:P[k][2]+1);
(%o17)                zvets_o1(P, k) := (P )  : (P )  + 1
k       k
2       2
(%i18) zmen_povol(P,k):=(P:delete(k,P));
(%o18)               zmen_povol(P, k) := P : delete(k, P)
(%i19) zmen_povol_o1(P,k):=(P:delete(k,P));
(%o19)              zmen_povol_o1(P, k) := P : delete(k, P)
(%i20) set_exp_1(P):=(j:1, for i in P do (P[j][2]:1,j:j+1));
(%o20)   set_exp_1(P) := (j : 1, for i in P do ((P )  : 1, j : j + 1))
j
2
(%i21)  smaz_jedno(P):=(i:random(length(P))+1,P:delete(P[i],P));
(%o21)  smaz_jedno(P) := (i : random(length(P)) + 1, P : delete(P , P))
i
(%i22) smaz_jedno_lich(P):=(i:random(length(P)-1)+2,P:delete(P[i],P));
(%o22) smaz_jedno_lich(P) := (i : random(length(P) - 1) + 2, P : delete(P , P))
i
(%i23) smaz_jedno_bez_posledniho(P):=(if (length(P)=1) then (i:1) else (i:random(length(P)-1)+1),P:delete(P[i],P));
(%o23) smaz_jedno_bez_posledniho(P) :=
(if length(P) = 1 then i : 1 else i : random(length(P) - 1) + 1,
P : delete(P , P))
i
(%i24) smaz_jedno_bez_posledniho_lich(P):=(if (length(P)=2) then (i:2) else (i:random(length(P)-2)+2),P:delete(P[i],P));
(%o24) smaz_jedno_bez_posledniho_lich(P) :=
(if length(P) = 2 then i : 2 else i : random(length(P) - 2) + 2,
P : delete(P , P))
i
(%i25) pridej_jedno(P,m):=(P:append(P,[[next_prime(m),1]]));
(%o25)     pridej_jedno(P, m) := P : append(P, [[next_prime(m), 1]])
(%i26) get_max_prim(L):=(L[length(L)][1]);
(%o26)                 get_max_prim(L) := (L         )
length(L)
1
(%i27) check_max(d3,P):=(d4:d3,if (d4>
1) then (d4:1/d4), if (d4#1 and bfloat(d4)>
bfloat(dmax)) then (dmax:d4,Lmax:P));
1
(%o27) check_max(d3, P) := (d4 : d3, if d4 > 1 then d4 : --,
d4
if (d4 # 1) and (bfloat(d4) > bfloat(dmax)) then (dmax : d4, Lmax : P))
(%i28) get_num(n):=(next_prime(n+random(3*n)));
(%o28)             get_num(n) := next_prime(n + random(3 n))
(%i29) generuj(P):=(x:2,n:random(10), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=40) then (P:append(P,[[x,1]]),cnt:cnt+1)),n:random(18), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=10) then (P:append(P,[[x,1]]),cnt:cnt+1)),n:random(12), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=3) then (P:append(P,[[x,1]]),cnt:cnt+1)),P);
(%o29) generuj(P) := (x : 2, n : random(10), cnt : 0,
for i while cnt < n do (x : next_prime(x),
if random(100) <= 40 then (P : append(P, [[x, 1]]), cnt : cnt + 1)),
n : random(18), cnt : 0, for i while cnt < n
do (x : next_prime(x), if random(100) <= 10
then (P : append(P, [[x, 1]]), cnt : cnt + 1)), n : random(12), cnt : 0,
for i while cnt < n do (x : next_prime(x),
if random(100) <= 3 then (P : append(P, [[x, 1]]), cnt : cnt + 1)), P)
(%i30) divsum2([[2,4],[31,1]]);
(%o30)                                992
(%i31) 2*2^4*31;
(%o31)                                992
(%i32) ```
Run Example
```SEMICOL:ascii(59);
(%o1)                                  ;
(%i2) MAXEX:800;
(%o2)                                 800
(%i3) MX_STEPS:15;
(%o3)                                 15
(%i4) set_random_state(make_random_state(true));
(%o4)                                done
(%i5) get_number_from_list_old(P):=(s:1,for i in P do s:s*first(i)^second(i),s);
(%o5) get_number_from_list_old(P) := (s : 1,
second(i)
for i in P do s : s first(i)         , s)
(%i6) get_number_from_list(P):=(s:1,for i in P do s:s*first(i)^second(i),s:s*Num1^Exp1*Num2^Exp2,s);
(%o6) get_number_from_list(P) := (s : 1,
second(i)            Exp1     Exp2
for i in P do s : s first(i)         , s : s Num1     Num2    , s)
(%i7) divsum2(P):=(s:1,for i in P do s:s*(first(i)^(second(i)+1)-1)/(first(i)-1),s);
second(i) + 1
s (first(i)              - 1)
(%o7) divsum2(P) := (s : 1, for i in P do s : -----------------------------, s)
first(i) - 1
(%i8) write_number_from_list(P):=(s:"1",for i in P do s:sconcat(s,"*",first(i),"^",second(i)),s);
(%o8) write_number_from_list(P) := (s : "1",
for i in P do s : sconcat(s, "*", first(i), "^", second(i)), s)
(%i9) write_povol_from_list(Pov):=(s:"",for i in Pov do s:sconcat(s,",",i),s);
(%o9) write_povol_from_list(Pov) := (s : "",
for i in Pov do s : sconcat(s, ",", i), s)
(%i10) create_number_from_list(P,name):=(s:sconcat(name,":[]",SEMICOL," "),for i in P do s:sconcat(s,name,":append(",name,",[[",first(i),",",second(i),"]])",SEMICOL," "),s);
(%o10) create_number_from_list(P, name) :=
(s : sconcat(name, ":[]", SEMICOL, " "),
for i in P do s : sconcat(s, name, ":append(", name, ",[[", first(i), ",",
second(i), "]])", SEMICOL, " "), s)
(%i11) create_number_from_list2(P,name):=(s:aconcat(name,":["),for i in P do s:sconcat(s,"[",first(i),",",second(i),"],"),s:substring(s,1,slength(s)),s:sconcat(s,"]",SEMICOL),s);
(%o11) create_number_from_list2(P, name) :=
(s : aconcat(name, ":["), for i in P do s :
sconcat(s, "[", first(i), ",", second(i), "],"),
s : substring(s, 1, slength(s)), s : sconcat(s, "]", SEMICOL), s)
(%i12) is_deffic(P):=block(n:get_number_from_list(P), if (divsum(n) <
2*n) then return (1) else return (0));
(%o12) is_deffic(P) := block(n : get_number_from_list(P),
if divsum(n) < 2 n then return(1) else return(0))
(%i13) deffic(P):=block(n:get_number_from_list(P), divsum(n)/(2*n));
divsum(n)
(%o13)    deffic(P) := block(n : get_number_from_list(P), ---------)
2 n
(%i14) nastav_povol(P):=(P2:[], j:1, for i in P do (P2:append(P2,[j]),j:j+1),P2);
(%o14) nastav_povol(P) := (P2 : [], j : 1,
for i in P do (P2 : append(P2, [j]), j : j + 1), P2)
(%i15) najdi_index(Pov):=(random(length(Pov))+1);
(%o15)            najdi_index(Pov) := random(length(Pov)) + 1
(%i16) zvets(P,k):=(P[k][2]:MAXEX);
(%o16)                   zvets(P, k) := (P )  : MAXEX
k
2
(%i17) zvets_o1(P,k):=(P[k][2]:P[k][2]+1);
(%o17)                zvets_o1(P, k) := (P )  : (P )  + 1
k       k
2       2
(%i18) zmen_povol(P,k):=(P:delete(k,P));
(%o18)               zmen_povol(P, k) := P : delete(k, P)
(%i19) zmen_povol_o1(P,k):=(P:delete(k,P));
(%o19)              zmen_povol_o1(P, k) := P : delete(k, P)
(%i20) set_exp_1(P):=(j:1, for i in P do (P[j][2]:1,j:j+1));
(%o20)   set_exp_1(P) := (j : 1, for i in P do ((P )  : 1, j : j + 1))
j
2
(%i21)  smaz_jedno(P):=(i:random(length(P))+1,P:delete(P[i],P));
(%o21)  smaz_jedno(P) := (i : random(length(P)) + 1, P : delete(P , P))
i
(%i22) smaz_jedno_lich(P):=(i:random(length(P)-1)+2,P:delete(P[i],P));
(%o22) smaz_jedno_lich(P) := (i : random(length(P) - 1) + 2, P : delete(P , P))
i
(%i23) smaz_jedno_bez_posledniho(P):=(if (length(P)=1) then (i:1) else (i:random(length(P)-1)+1),P:delete(P[i],P));
(%o23) smaz_jedno_bez_posledniho(P) :=
(if length(P) = 1 then i : 1 else i : random(length(P) - 1) + 1,
P : delete(P , P))
i
(%i24) smaz_jedno_bez_posledniho_lich(P):=(if (length(P)=2) then (i:2) else (i:random(length(P)-2)+2),P:delete(P[i],P));
(%o24) smaz_jedno_bez_posledniho_lich(P) :=
(if length(P) = 2 then i : 2 else i : random(length(P) - 2) + 2,
P : delete(P , P))
i
(%i25) pridej_jedno(P,m):=(P:append(P,[[next_prime(m),1]]));
(%o25)     pridej_jedno(P, m) := P : append(P, [[next_prime(m), 1]])
(%i26) get_max_prim(L):=(L[length(L)][1]);
(%o26)                 get_max_prim(L) := (L         )
length(L)
1
(%i27) check_max(d3,P):=(d4:d3,if (d4>
1) then (d4:1/d4), if (d4#1 and bfloat(d4)>
bfloat(dmax)) then (dmax:d4,Lmax:P));
1
(%o27) check_max(d3, P) := (d4 : d3, if d4 > 1 then d4 : --,
d4
if (d4 # 1) and (bfloat(d4) > bfloat(dmax)) then (dmax : d4, Lmax : P))
(%i28) get_num(n):=(next_prime(n+random(3*n)));
(%o28)             get_num(n) := next_prime(n + random(3 n))
(%i29) generuj(P):=(x:2,n:random(10), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=40) then (P:append(P,[[x,1]]),cnt:cnt+1)),n:random(18), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=10) then (P:append(P,[[x,1]]),cnt:cnt+1)),n:random(12), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=3) then (P:append(P,[[x,1]]),cnt:cnt+1)),P);
(%o29) generuj(P) := (x : 2, n : random(10), cnt : 0,
for i while cnt < n do (x : next_prime(x),
if random(100) <= 40 then (P : append(P, [[x, 1]]), cnt : cnt + 1)),
n : random(18), cnt : 0, for i while cnt < n
do (x : next_prime(x), if random(100) <= 10
then (P : append(P, [[x, 1]]), cnt : cnt + 1)), n : random(12), cnt : 0,
for i while cnt < n do (x : next_prime(x),
if random(100) <= 3 then (P : append(P, [[x, 1]]), cnt : cnt + 1)), P)
(%i30) divsum2([[2,1],[3,1]]);
(%o30)                                12
(%i31) ```
Run Example
```SEMICOL:ascii(59);
(%o1)                                  ;
(%i2) MAXEX:800;
(%o2)                                 800
(%i3) MX_STEPS:15;
(%o3)                                 15
(%i4) set_random_state(make_random_state(true));
(%o4)                                done
(%i5) get_number_from_list_old(P):=(s:1,for i in P do s:s*first(i)^second(i),s);
(%o5) get_number_from_list_old(P) := (s : 1,
second(i)
for i in P do s : s first(i)         , s)
(%i6) get_number_from_list(P):=(s:1,for i in P do s:s*first(i)^second(i),s:s*Num1^Exp1*Num2^Exp2,s);
(%o6) get_number_from_list(P) := (s : 1,
second(i)            Exp1     Exp2
for i in P do s : s first(i)         , s : s Num1     Num2    , s)
(%i7) divsum2(P):=(s:1,for i in P do s:s*(first(i)^(second(i)+1)-1)/(first(i)-1),s:s*(Num1^(Exp1+1)-1)/(Num1-1)*(Num2^(Exp2+1)-1)/(Num2-1),s);
second(i) + 1
s (first(i)              - 1)
(%o7) divsum2(P) := (s : 1, for i in P do s : -----------------------------,
first(i) - 1
Exp1 + 1
s (Num1         - 1)      Exp2 + 1
-------------------- (Num2         - 1)
Num1 - 1
s : ---------------------------------------, s)
Num2 - 1
(%i8) write_number_from_list(P):=(s:"1",for i in P do s:sconcat(s,"*",first(i),"^",second(i)),s);
(%o8) write_number_from_list(P) := (s : "1",
for i in P do s : sconcat(s, "*", first(i), "^", second(i)), s)
(%i9) write_povol_from_list(Pov):=(s:"",for i in Pov do s:sconcat(s,",",i),s);
(%o9) write_povol_from_list(Pov) := (s : "",
for i in Pov do s : sconcat(s, ",", i), s)
(%i10) create_number_from_list(P,name):=(s:sconcat(name,":[]",SEMICOL," "),for i in P do s:sconcat(s,name,":append(",name,",[[",first(i),",",second(i),"]])",SEMICOL," "),s);
(%o10) create_number_from_list(P, name) :=
(s : sconcat(name, ":[]", SEMICOL, " "),
for i in P do s : sconcat(s, name, ":append(", name, ",[[", first(i), ",",
second(i), "]])", SEMICOL, " "), s)
(%i11) create_number_from_list2(P,name):=(s:aconcat(name,":["),for i in P do s:sconcat(s,"[",first(i),",",second(i),"],"),s:substring(s,1,slength(s)),s:sconcat(s,"]",SEMICOL),s);
(%o11) create_number_from_list2(P, name) :=
(s : aconcat(name, ":["), for i in P do s :
sconcat(s, "[", first(i), ",", second(i), "],"),
s : substring(s, 1, slength(s)), s : sconcat(s, "]", SEMICOL), s)
(%i12) is_deffic(P):=block(n:get_number_from_list(P), if (divsum(n) <
2*n) then return (1) else return (0));
(%o12) is_deffic(P) := block(n : get_number_from_list(P),
if divsum(n) < 2 n then return(1) else return(0))
(%i13) deffic(P):=block(n:get_number_from_list(P), divsum(n)/(2*n));
divsum(n)
(%o13)    deffic(P) := block(n : get_number_from_list(P), ---------)
2 n
(%i14) nastav_povol(P):=(P2:[], j:1, for i in P do (P2:append(P2,[j]),j:j+1),P2);
(%o14) nastav_povol(P) := (P2 : [], j : 1,
for i in P do (P2 : append(P2, [j]), j : j + 1), P2)
(%i15) najdi_index(Pov):=(random(length(Pov))+1);
(%o15)            najdi_index(Pov) := random(length(Pov)) + 1
(%i16) zvets(P,k):=(P[k][2]:MAXEX);
(%o16)                   zvets(P, k) := (P )  : MAXEX
k
2
(%i17) zvets_o1(P,k):=(P[k][2]:P[k][2]+1);
(%o17)                zvets_o1(P, k) := (P )  : (P )  + 1
k       k
2       2
(%i18) zmen_povol(P,k):=(P:delete(k,P));
(%o18)               zmen_povol(P, k) := P : delete(k, P)
(%i19) zmen_povol_o1(P,k):=(P:delete(k,P));
(%o19)              zmen_povol_o1(P, k) := P : delete(k, P)
(%i20) set_exp_1(P):=(j:1, for i in P do (P[j][2]:1,j:j+1));
(%o20)   set_exp_1(P) := (j : 1, for i in P do ((P )  : 1, j : j + 1))
j
2
(%i21)  smaz_jedno(P):=(i:random(length(P))+1,P:delete(P[i],P));
(%o21)  smaz_jedno(P) := (i : random(length(P)) + 1, P : delete(P , P))
i
(%i22) smaz_jedno_lich(P):=(i:random(length(P)-1)+2,P:delete(P[i],P));
(%o22) smaz_jedno_lich(P) := (i : random(length(P) - 1) + 2, P : delete(P , P))
i
(%i23) smaz_jedno_bez_posledniho(P):=(if (length(P)=1) then (i:1) else (i:random(length(P)-1)+1),P:delete(P[i],P));
(%o23) smaz_jedno_bez_posledniho(P) :=
(if length(P) = 1 then i : 1 else i : random(length(P) - 1) + 1,
P : delete(P , P))
i
(%i24) smaz_jedno_bez_posledniho_lich(P):=(if (length(P)=2) then (i:2) else (i:random(length(P)-2)+2),P:delete(P[i],P));
(%o24) smaz_jedno_bez_posledniho_lich(P) :=
(if length(P) = 2 then i : 2 else i : random(length(P) - 2) + 2,
P : delete(P , P))
i
(%i25) pridej_jedno(P,m):=(P:append(P,[[next_prime(m),1]]));
(%o25)     pridej_jedno(P, m) := P : append(P, [[next_prime(m), 1]])
(%i26) get_max_prim(L):=(L[length(L)][1]);
(%o26)                 get_max_prim(L) := (L         )
length(L)
1
(%i27) check_max(d3,P):=(d4:d3,if (d4>
1) then (d4:1/d4), if (d4#1 and bfloat(d4)>
bfloat(dmax)) then (dmax:d4,Lmax:P));
1
(%o27) check_max(d3, P) := (d4 : d3, if d4 > 1 then d4 : --,
d4
if (d4 # 1) and (bfloat(d4) > bfloat(dmax)) then (dmax : d4, Lmax : P))
(%i28) get_num(n):=(next_prime(n+random(3*n)));
(%o28)             get_num(n) := next_prime(n + random(3 n))
(%i29) generuj(P):=(x:2,n:random(10), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=40) then (P:append(P,[[x,1]]),cnt:cnt+1)),n:random(18), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=10) then (P:append(P,[[x,1]]),cnt:cnt+1)),n:random(12), cnt:0, for i: 1 while cnt <
n do (x:next_prime(x), if (random(100)<
=3) then (P:append(P,[[x,1]]),cnt:cnt+1)),P);
(%o29) generuj(P) := (x : 2, n : random(10), cnt : 0,
for i while cnt < n do (x : next_prime(x),
if random(100) <= 40 then (P : append(P, [[x, 1]]), cnt : cnt + 1)),
n : random(18), cnt : 0, for i while cnt < n
do (x : next_prime(x), if random(100) <= 10
then (P : append(P, [[x, 1]]), cnt : cnt + 1)), n : random(12), cnt : 0,
for i while cnt < n do (x : next_prime(x),
if random(100) <= 3 then (P : append(P, [[x, 1]]), cnt : cnt + 1)), P)
(%i30) divsum2([[2,1]]);
Exp1 + 1           Exp2 + 1
3 (Num1         - 1) (Num2         - 1)
(%o30)              ---------------------------------------
(Num1 - 1) (Num2 - 1)
(%i31) ```