How to find double output?
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Ammy
 el 2 de Mzo. de 2022
  
    
    
    
    
    Comentada: Ammy
 el 2 de Mzo. de 2022
             import java.math.*;
>> p=BigInteger('11');
>> m=BigInteger('2');
>> [A,B]=m.gcd(p);
Error using java.math.BigInteger/gcd
Java methods cannot be called with multiple output arguments
How  to resolve this issue? I need both A and B.
Thanking in anticipation
7 comentarios
Respuesta aceptada
  Walter Roberson
      
      
 el 2 de Mzo. de 2022
         import java.math.*;
 p = BigInteger('11');
 m = BigInteger('2');
 A = m.gcd(p)
 B = m.modInverse(p)
m.multiply(B).mod(p)
3 comentarios
  Walter Roberson
      
      
 el 2 de Mzo. de 2022
				 import java.math.*;
 p = BigInteger('11');
 m = BigInteger('2');
 a = inverse(m, p)
 %cross-check
 cross_check = m.multiply(a).mod(p)
function a = inverse(b, p)
    import java.math.*;
    A = b.gcd(p);
    if A == BigInteger('1')
        a = b.modInverse(p);
    else
        a = BigInteger('0');
    end
end
Más respuestas (0)
Ver también
Categorías
				Más información sobre Logical en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!