Luigi
is there a way to make a counter that takes numbers invidually?
Luigi
i mean
Luigi
without using cout, because i need to put in output the biggest number of a group of numbers, that i have to put in a counter
Anonymous
Anonymous
Luigi
yeah sure, wait a moment
Luigi
i have to find prime factors of a number (600851475143). And i have to output only the biggest prime factor
Luigi
I think i should put in a counter all the prime factors, so then i can output only the biggest one
Anonymous
Anonymous
Anonymous
and try to find a mathematical solution
Anonymous
then implement it
Luigi
i have the mathematical solution
Luigi
i just don't have the programming solution ahah
Anonymous
use arrays
Luigi
mh
Luigi
i think i got it
Ariana
Luigi
well, that's the exercise ahah
Ariana
at that point you will have to implement primality test
Anonymous
N = (a + b)(a - b) = a(pw2) - b(pw2) this is how I do via math
Anonymous
eh
Luigi
wait, let me send you my code
Anonymous
Checkout: Fermat's factorization method
Luigi
int f,p,pmax;
pmax=0;
while (f<=600851475143) {
if (f%600851475143==0)
f=p;
if (p>pmax)
p=pmax;
f++;
}
cout<<"Il fattore primo piu' grande e' "<<p; (it's wrote in italian ahah)
Anonymous
Luigi
but it doesn't work, that's is my idea btw
Luigi
what do you mean with fermat?
Anonymous
Is there way to use system function and use %d in it
Ariana
wut
Ariana
Ariana
Ariana
Wayyyy too slow
Anonymous
Ariana
Fermat factorization sucks unless the number is known to be easily factored under fermat factorization
Anonymous
There is better solution, but I am not familar to
Ariana
Just dont use fermat
Ariana
Its worse than trial divisopn
Luigi
Luigi
like where?
Ariana
Pollard's rho algorithm is rather easy to do
Luigi
Luigi
that looks hard tho
Anonymous
like where?
You start with "If a(^p) is divided by p, then the remainder obtained is the same when a is divided by p." I don't know better than this algo
Ariana
factorization is hard
Ariana
Thats why no one writes their own code for it mdr
Luigi
Luigi
and what does (^p) mean?
Anonymous
Hi all!
klimi
Hi
MᏫᎻᎯᎷᎷᎬᎠ
Hi
Anonymous
Ask an intelligent question.
MᏫᎻᎯᎷᎷᎬᎠ
Anonymous
Pete
If I have a game in c++ and I need to modify it in c, do I have to go through the whole thing and convert it to c first?
joel
Pete
yes
Okay.
Because you can’t program physical features of a pi3 in c++?
Pete
Like button, lights , motors
Anonymous
Nehemiah Aklil
Anonymous
I thought about that, but since he said he's a beginner I pickup falcon
Anonymous
(I'm a beginner as well)
Nehemiah Aklil
Luigi
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Luigi
Any tip to give me?
Luigi
That's how i actually did it, but it's not working.
Luigi
while (f<=600851475143) {
if (f%600851475143==0)
f=p;
if (p>pmax)
p=pmax;
f++;
}
Luigi
( this is only the loop )
Luigi
Could someone explain me Pollard's rho algorithm?
Francisco
Luigi
6857
I didn't need that answer ahah, i needing a tip on how could i make it
Luigi
I don't know how to do pollard's algorithm, it's impossibile ahah