frogboy77 73 Posting Pro in Training

I won't deny i feel i really should be outraged, but i just can't really summon up the disgust.

frogboy77 73 Posting Pro in Training

:-/
yeah, still not really bothered.

frogboy77 73 Posting Pro in Training

Thoughts Of The Day

I'm still waiting for one(never mind plural).

frogboy77 73 Posting Pro in Training

i like you, i hope things work out for you.:)

and i think you're too young too consider this "the one".
just my opinion as i've started to get old.

frogboy77 73 Posting Pro in Training

Your name seems familiar, are you a Euler regular?

frogboy77 73 Posting Pro in Training

I'm good thanks. How are you?

No, just tired of life. Ready for infinite happiness.

perhaps not so good.

frogboy77 73 Posting Pro in Training

@ziggystarman

Having just reread your comments on my code snippet i have a question:

is this your own work?

frogboy77 73 Posting Pro in Training

thanks, i will have a play about with it:)

frogboy77 73 Posting Pro in Training

I was referring to your code and not the algorithm itself.

frogboy77 73 Posting Pro in Training

@The Bowie fan

I tried recently to write a miller-rabin function and failed:(

How reliable do you think this code is (i.e have you tested it?) given the simple omission already noted?

frogboy77 73 Posting Pro in Training

Ok think of it like this;

if you tried to divide by 2 and it didn't work then anything over n/2 can't be a factor.

if you tried to divide by 3 and it didn't work then anything over n/3 can't be a factor.

if you tried to divide by 5(no point in 4 as 2 didn't work) and it didn't work then anything over n/5 can't be a factor.

etc.. etc..

until you come to the square root.

frogboy77 73 Posting Pro in Training

in order to find out whether a numbr is prime r nt we only need to divide it till half of its value...and if it doesnt get divided by any of the numbers in the first half then it wont be divided by any number in the 2nd half fr sure....

No square root will suffice.

P.S please use code tags.

frogboy77 73 Posting Pro in Training

Where is rand seeded?

frogboy77 73 Posting Pro in Training

very cool

frogboy77 73 Posting Pro in Training

Dev-C++ is updated frequently and includes all of the library's you will probably ever use (using the new standards)

http://en.wikipedia.org/wiki/Dev-C%2B%2B

jonsca commented: True +6
frogboy77 73 Posting Pro in Training

Result = SumY - SumX;

Would it not be
Result=SumY-SumX+x;?

frogboy77 73 Posting Pro in Training

It appears to be the case of
those who can, do, those who can't, teach.

bumsfeld commented: sweet +0
jon.kiparsky commented: Terrible case of mistaken induction. +0
frogboy77 73 Posting Pro in Training

No, just tired of life. Ready for infinite happiness.

I hope you find it.

frogboy77 73 Posting Pro in Training

can you elaborate?
sorry, would you elaborate?

frogboy77 73 Posting Pro in Training

are you Mayan?

frogboy77 73 Posting Pro in Training

still waiting for a clarification on this

You can also remove a<4 because you already have a<9.

frogboy77 73 Posting Pro in Training

Why?

well how else you going test it?

frogboy77 73 Posting Pro in Training

square root is far enough

frogboy77 73 Posting Pro in Training

why go as far as i_Val/2?

frogboy77 73 Posting Pro in Training

ok find all the primes from 10000000-20000000 with each one and time it.

frogboy77 73 Posting Pro in Training

maybe just me being a noob but that looks like shit!

frogboy77 73 Posting Pro in Training

so you're returning a char value from an int function with a bool value?

frogboy77 73 Posting Pro in Training

still pretty new at this but i don't get this

char bPrime;
    bPrime = true;
frogboy77 73 Posting Pro in Training

yes but 2 would be evaluated before that

frogboy77 73 Posting Pro in Training

i'm guessing if he can't use arrays then vectors are off the table.

frogboy77 73 Posting Pro in Training

no reply?

frogboy77 73 Posting Pro in Training

i realise there is no error checking for a<1 but as the title says "simple"

frogboy77 73 Posting Pro in Training

no then line 5 would return false if a=2

frogboy77 73 Posting Pro in Training

ok but i find following one statement after another easier than trying to evaluate 3 or 4 in one go. thanks for comments and i will keep them in mind.

frogboy77 73 Posting Pro in Training

really! you find that easier to read?

frogboy77 73 Posting Pro in Training

would that be better?

frogboy77 73 Posting Pro in Training

you need to mark it solved

frogboy77 73 Posting Pro in Training
bool is_prime(int a)
{
     if(a==1){return false;}
     if(a<4){return true;}
     if(a%2==0){return false;}
     if(a<9){return true;}
     if(a%3==0){return false;}
     int i;
     for(i=5;(i*i)<=a;i+=6)
     {
                           if(a%i==0){return false;}
                           if(a%(i+2)==0){return false;}
     }
     return true;
}

critique welcome.

frogboy77 73 Posting Pro in Training

I would suggest posting less code and a specific question about what you are looking for.

frogboy77 73 Posting Pro in Training

Does your compiler not have a problem with line 16(i.e declaring a variable twice)?

frogboy77 73 Posting Pro in Training

meant to add

a=b;
frogboy77 73 Posting Pro in Training
a=4596;
b=(((a/100)%10)+((a/1000)*10)+((a%10)*100)+(((a/10)%10)*1000));

may work but arrays or strings would be easier.

frogboy77 73 Posting Pro in Training

If you want any help (and you do from the above poster) then an amount of effort shown really is required.

frogboy77 73 Posting Pro in Training

i believe this line

while (pick != 'r' || pick != 'g' || pick != 'b');

should be

while (pick != 'r' && pick != 'g' && pick != 'b');
frogboy77 73 Posting Pro in Training

then i think what you have is good.

frogboy77 73 Posting Pro in Training

If room 5 doesn't exist the home may smell rather "funky".

Lighting would be the least of your problems.

frogboy77 73 Posting Pro in Training

would this do it?

if(iWhole/10000==iWhole%10&&(iWhole/1000)%10==(iWhole/10)%10){is_pal=true;}
else{is_pal=false;}
frogboy77 73 Posting Pro in Training
frogboy77 73 Posting Pro in Training

So nobody knows ???

"Nobody knows" what you are asking.

frogboy77 73 Posting Pro in Training

Try to do it with pen and paper, then write some code for the process you used using arrays.