Hi Nicolas,
VPI uses a Pollard rho algorithm for factoring. While it is significantly better than MATLAB's builtin factor tool, which can only handle numbers as large as about 10 digits or so, the scheme I used is often ineffectual on numbers that are the product of two seriously large primes. Of course, that is a difficult problem in general, else many of the encryption schemes in common use today would fail miserably.
One of my goals has been to re-write factor to use a better scheme, but until then I should put in a warning message when factor has failed to resolve a composite number fully into its prime factors.
So you did nothing wrong here, except to give factor a number too large for it to handle.

Hi.
First, great tools!
Second, what am I doing wrong?
>> p1 = vpi('40094690950920881030683735292761468389214899724061')
p1 =
40094690950920881030683735292761468389214899724061
>> p2 = vpi('37975227936943673922808872755445627854565536638199')
p2 = 37975227936943673922808872755445627854565536638199
>> factor(p1*p2)
ans =
1522605027922533360535618378132637429718068114961380688657908494580122963258952897654000350692006139
It should give p1 and p2...
Thanks!

Thanks sir.
if someone is interested, I answer my question about using vpi in simulink (see below comment). I converted the vpi number into a matrix of bits (actually a bit is stored in double).
here are the steps :
seed = vpi('123456789')
N0 = randint(vpi(seed),[1,1])
N1 = vpi2bin(N0) % Convert vpi from decimal to binary form
N2 = [N1 - '0'] % Convert number to string (vector)
N3 = vec2mat(N2,8) % Convert vector into matrix of 8 columns.

N = vpi('123456789012345678901234567890');
vpi2bin(N)
ans =
1100011101110100100001111111101101100001101110011111000001110111001001110001111110000101011010010
I suppose in hindsight, I should have used dec2bin as the name for this.

Comment only