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?
Type: Posts; User: programmer123
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?
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?
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.
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...
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...
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...
Those were the model answers given to use for testing
--- Update ---
Are you experiencing the same issue when running it for 2211744201787?
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...
public static void main(String args[]) throws IOException {
long startTime = System.currentTimeMillis();
FactoriseDixon("224573", "7", startTime, 1);
...
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.
...
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),...
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...
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));
...
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...
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...
public static void main(String args[]) throws IOException {
BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter number:");
...