The #
(number sign) character is used both as a prefix operator and as a postfix operator.
# (primorial)
The primorial function.
Syntax
-
n#
-
n
is 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
-
X
is 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
s
is a string, then#s
is the length ofs
, that is, the number of characters ins
. -
If
v
is a vector, then#v
is the dimension ofv
, that is, the number of entries, or components, ofv
. -
If
A
is a matrix, then#A
is the number of entries inA
. -
If
L
is a list, then#L
is the number of elements ofL
. -
If
S
is a set, then#S
is the cardinality ofS
, that is, the number of elements ofS
. -
If
pm
is a pixmap, then#pm
is 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