Watch this Author's files
My hats off, John.
A three liner then, that will be fairly efficient.
f = x ./(1:ceil(sqrt(x))); f = f(f==fix(f)).' ; f = unique([f;x./f]);
For example, when x = 2^25, the two liner takes Elapsed time is 114.624158 seconds.
While my three liner takes only Elapsed time is 0.139695 seconds.
Nice two-liner, Jos. But note that this entry has memory and speed advantages. Try a large number, like 2^25.
The help should be improved. Add a H1 line, describe the expected input and output, give an example and add a See Also line.
The following two-liner will produce the same result: f = x ./ [x:-1:1] ; f = f(f==fix(f)).' ;
Its functionality is therefore quite trivial.
Contact us at files@mathworks.com