Ad
  • Default User Avatar

    The returned value will be negative in case of the following input (Will not be long):
    int n = 2;
    int m = 1000000000;
    Plus, it takes too much time in case of such inputs as too many additional numbers are generated
    with that range method then to be filtered.