The # (number sign) character is used both as a prefix operator and as a postfix operator.
# (primorial)
The primorial function.
Syntax
-
n#-
nis an integer
-
Description
If n is an integer, then n# is the product of all prime numbers less than or equal to n.
Notes
The postfix operator # is mapped to the primorial function.
Examples
50#
614889782588491410
100#
2.30556796395⋅10^36
SequenceVector(15) @ primorial
(1, 2, 6, 6, 30, 30, 210, 210, 210, 210, 2310, 2310, 30030, 30030, 30030)
See also
# (length)
The length function.
Syntax
-
#X-
Xis a string, vector, matrix, list, set, or pixmap
-
Description
In general, if X is a container, then #X is the number of elements it contains. Depending on the type of X, this number is typically referred to as the “cardinality”, “dimension”, “length”, or “size” of X.
-
If
sis a string, then#sis the length ofs, that is, the number of characters ins. -
If
vis a vector, then#vis the dimension ofv, that is, the number of entries, or components, ofv. -
If
Ais a matrix, then#Ais the number of entries inA. -
If
Lis a list, then#Lis the number of elements ofL. -
If
Sis a set, then#Sis the cardinality ofS, that is, the number of elements ofS. -
If
pmis a pixmap, then#pmis the number of pixels inpm.
Notes
The prefix operator # is mapped to the length function.
Examples
P ≔ filter(SequenceList(1000), IsPrime); #P
168
#functions()
781
f ≔ n ↦ if(even(n), n/2, 3⋅n + 1);
#orbit(f, 1000)
112
A ≔ ❨❨6, 3, 2, 0, 4, 5❩, ❨7, 0, 2, 1, 4, 2❩, ❨6, 2, 3, 1, 4, 2❩, ❨8, 0, 2, 3, 3, 5❩, ❨4, 2, 6, 3, 2, 0❩❩
⎛6 3 2 0 4 5⎞ ⎜7 0 2 1 4 2⎟ ⎜6 2 3 1 4 2⎟ ⎜8 0 2 3 3 5⎟ ⎝4 2 6 3 2 0⎠
#A
30