- 2,163
- 191
I am writing and I am thinking about it. Just when I write the codes things happen.Vanadium 50 said:Your refusal to write pseudocode is a mistake. Just sayin'.
The discussion focuses on finding the largest prime factor of the number 600851475143 using Python. Participants explore various coding approaches, including using loops and the square root method for efficiency. Key issues highlighted include the inefficiency of checking all numbers up to N and the importance of utilizing integer division to avoid float errors. The conversation emphasizes the necessity of pseudocode and structured programming to clarify logic and improve code readability.
PREREQUISITESMathematicians, computer science students, and software developers interested in number theory and efficient algorithm design for prime factorization.
I am writing and I am thinking about it. Just when I write the codes things happen.Vanadium 50 said:Your refusal to write pseudocode is a mistake. Just sayin'.
N=600851475143
b=1
while True:
if N%b==0:
t=N//b
b=b+1
print (t)
else:
b=b+1
Sorry you're having such a time, but thanks for sharing the website,Arman777 said:Another sad thing is this is the 3rd problem in the project euler site
Or a flowchart, perhaps.Vanadium 50 said:Your refusal to write pseudocode is a mistake. Just sayin'.
Yes and I actually come here to thank @StoneTemplePython for introducing me to the site, but I saw your post so your welcome somehow :)scottdave said:Sorry you're having such a time, but thanks for sharing the website,
https://projecteuler.net
I think that's just what I need for some practice problems.
I'm on my phone and I did the 1st one on my phone using Google Sheets while my kid is at swim practice .
[emoji2] not everything has to be done in Python
Well, I guess that's a good approach, the interesting thing is 4th, 5th or 6th problems are much easier than the 3rd one somehow (at least for me).scottdave said:Or a flowchart, perhaps.
I used a spreadsheet to solve this. Maybe I'll go try to write some code. I'm taking an online Python right now, so I think the extra practice will be good. But often you can use other tools.
My approach was to go along till I hit a factor, check to see if that number is prime. Take the original number 600851475143 and divide by that factor. Now I have a somewhat smaller number to find factors of. The next number that turns up to be a factor, divide by that one and I have a smaller number.
If you keep track of the product of these factors you've been saving, then you will know when to stop.
scottdave said:.
I'm on my phone and I did the 1st one on my phone using Google Sheets while my kid is at swim practice .
scottdave said:I'm taking an online Python right now, so I think the extra practice will be good. But often you can use other tools.
I haven't gone exactly in order. I'll work on one for a little while, then move on to another if I feel I'm stuck, then come back to revisit. These are the ones that I've solved so far: 1 thru 3, 5 thru 11, 13, 16, 19, 20, 22, 26, and 29Arman777 said:I come to the 9th problem ( I solved the earlier ones as well) and I'll try to do more and more, Its really great indeed.
Well, I guess that's a good approach, the interesting thing is 4th, 5th or 6th problems are much easier than the 3rd one somehow (at least for me).
7th took some time to solve but I manage to do it.
8th is really nice :)
Thars great :) Sure you canscottdave said:I haven't gone exactly in order. I'll work on one for a little while, then move on to another if I feel I'm stuck, then come back to revisit. These are the ones that I've solved so far: 1 thru 3, 5 thru 11, 13, 16, 19, 20, 22, 26, and 29
I haven't seen any problem where those are necessary. I found a 450-line version of the quadratic sieve online.Fred Wright said: