Okay, I made this program in order to solve this question(adsbygoogle = window.adsbygoogle || []).push({});

What is the smallest positive integer x such that x^2 + 3x + 5 is divisible by 121?

The program complies perfectly. But when I execute it, it don't print out any answer.

Code (Text):import java.math.BigInteger;

public class Number37

{

public static void main (String[] args)

{

BigInteger divider = BigInteger.valueOf(121);

BigInteger ZERO = BigInteger.ZERO;

BigInteger THREE = BigInteger.valueOf(3);

BigInteger FIVE = BigInteger.valueOf(5);

BigInteger n = BigInteger.valueOf(0);

BigInteger val1 = n.pow(2);

BigInteger val2 = n.multiply(THREE);

for (long i = 0; i < Long.MAX_VALUE; i++)

{

n = BigInteger.valueOf(i);

BigInteger value = (val1.add(val2)).add(FIVE);

if(value.remainder(divider) == ZERO)

{

System.out.println("N is equal to: " + n);

return;

}

}

}

}

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# BigInteger Remainder Help

Loading...

Similar Threads for BigInteger Remainder Help | Date |
---|---|

Python (VPython) Can someone help me with my orbit simulator? | Monday at 12:43 AM |

I need help decrypting this | Mar 24, 2018 |

C/++/# Help with MATLAB code? | Feb 9, 2018 |

Python What's wrong with my bisection method code? | Dec 10, 2017 |

**Physics Forums - The Fusion of Science and Community**