forked from stdlib-js/stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.txt
More file actions
55 lines (40 loc) · 1.3 KB
/
repl.txt
File metadata and controls
55 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{{alias}}( N, M, initial, si, oi, out, so, oo )
Factorizes a sequence length into a product of integers.
Factorization results are stored in the output array sequentially, where
the first element contains the sequence length N, the second element
contains the number of factors into which N was decomposed and subsequent
elements contain the individual integer factors.
Any remaining array space remains as unused storage.
Parameters
----------
N: integer
Length of the sequence.
M: integer
Number of trial divisors.
initial: Collection<number>
Array of initial trial divisors.
si: integer
Stride length for `initial`.
oi: integer
Starting index for `initial`.
out: Collection<number>
Output array for storing factorization results.
so: integer
Stride length for `out`.
oo: integer
Starting index for `out`.
Returns
-------
numFactors: integer
Number of factors into which N was decomposed.
Examples
--------
> var N = 630;
> var initial = [ 3, 4, 2, 5 ];
> var factors = [ 0, 0, 0, 0, 0, 0, 0 ];
> var numFactors = {{alias}}( N, 4, initial, 1, 0, factors, 1, 0 )
5
> factors.slice()
[ 630, 5, 2, 3, 3, 5, 7 ]
See Also
--------