Search:

Type: Posts; User: programmer123

Search: Search took 0.10 seconds.

  1. Replies
    2
    Views
    1,831

    Re: Python to Java

    Yeah my Dixons factorisation python code works as expected but like I say I don't know Java so having a very tough time converting it across.

    Happy to attach my code for you to have a look at?
  2. Replies
    2
    Views
    1,831

    Python to Java

    Hi, I have a piece of Python code that I have coded that has been requested to be done in Java. I have hardly used Java before and was wondering if anyone could help me convert my code into Java?
  3. Re: Dixons factorisation implementation issue

    Not really an issue with the algorithm though its more the inefficiency of the for loop method.

    But if you cant help not to worry, thanks for looking into the issue anyways.
  4. Re: Dixons factorisation implementation issue

    It gets the expected values for the 10 previous yes.

    Its not caught up in a loop it just takes a long amount of time to iterate all the way up to that number (for loop starts from sqrt of n, in...
  5. Re: Dixons factorisation implementation issue

    The algorithm comes after my problem and that logic works, my issue is getting/testing if the correct pairs are being retrieved.

    I have added the snippet below for the first of the numbers that...
  6. Re: Dixons factorisation implementation issue

    Okay, well do you have any ideas on why/how to solve that issue? Because that is my issue, as you can see by running the 10 previous numbers they output as expected all within half a minute so my...
  7. Re: Dixons factorisation implementation issue

    Those were the model answers given to use for testing

    --- Update ---

    Are you experiencing the same issue when running it for 2211744201787?
  8. Re: Dixons factorisation implementation issue

    Im sorry can we focus on the actual issue I have as like I said previously the testing is just simply something I added to debug and locate the issue. So whether the t1- t4 can be set outside the...
  9. Re: Dixons factorisation implementation issue

    public static void main(String args[]) throws IOException {

    long startTime = System.currentTimeMillis();
    FactoriseDixon("224573", "7", startTime, 1);
    ...
  10. Re: Dixons factorisation implementation issue

    Testing is just a quick thing i added so those params will quickly need adjusting depending on which which number you are running or you can comment the testing if out if you want to run multiple.
    ...
  11. Re: Dixons factorisation implementation issue

    Hopefully this should get the code working for you. All of the others have been listed above. For testing purposes of the first one that "hangs" the values should be x1,x2=(80074177, 27381246816),...
  12. Re: Dixons factorisation implementation issue

    Have you adjusted the testing params to match the number you are using ?

    i.e. 3163 * 71 = 224573 - took 0 seconds # x1,x2=(1060, 735), y1,y2=(1954, 375) Bound 7
    t1 = 1060
    t2 = 735
    t3 = 1954
    t4...
  13. Re: Dixons factorisation implementation issue

    If you use the logic from my main, the one you tried would need 224573 as the number and 7 as the bound


    BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
    ...
  14. Re: Dixons factorisation implementation issue

    Its hard to debug because I don't know at what number of iterations of the for loop will generate those required 4 digits. Which is why I put a check to make sure they are those 4 digits. The fact...
  15. Re: Dixons factorisation implementation issue

    I have added in a testing section where I check that is getting the right pairs.

    if (res1 && res2 && res3 && res4) {
    //breakpoint here i.e. if this breakpoint is hit the correct pairs are being...
  16. Dixons factorisation implementation issue

    public static void main(String args[]) throws IOException {

    BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter number:");
    ...
Results 1 to 16 of 16