palindromic primes



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

Re: palindromic primes

Postby Ed Goodman » Fri Nov 18, 2011 11:00 pm

By my calculations, Enrico's good mood lasted eight hours and forty-one minutes.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: palindromic primes

Postby enrico-sorichetti » Fri Nov 18, 2011 11:12 pm

Yep, my good mood disappeared when the TS posted
i don't know c code but it was part of this particular challenge


;)
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: palindromic primes

Postby Akatsukami » Sat Nov 19, 2011 1:06 am

BillyBoyo wrote:There's a thought. I could set up one of those for Cobol. I could call it the IOC.... rats.

You just have to think of a COBOL-oriented name. Like the OO version of C is C++, and the OO version of COBOL is ADD 1 TO COBOL GIVING OBJECT-ORIENTED-COBOL :mrgreen:
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: palindromic primes

Postby BillyBoyo » Sat Nov 19, 2011 1:19 am

I could cheat, and take the winner of the C thing and use ENTER. Just a pity it was never actually implemented...

I wonder if COBOL is a reserved word?

In a not-necessarily-similar-vein, I like the idea of DATA + ALGORITHMS = S0C7, if either or both do not contain valid numeric data...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: palindromic primes

Postby dick scherrer » Sat Nov 19, 2011 11:34 am

We've heard for many, many years thet the GO TO is "bad" (opinions vary).

With the new OO stuff, might a COME FROM construct in COBOL be handy. Something like the old task / rendezvous. . . 8-)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: palindromic primes

Postby clrgq » Sun Nov 20, 2011 5:06 am

lol no ioccc submission, im a total newb
clrgq
 
Posts: 12
Joined: Tue Oct 25, 2011 4:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: palindromic primes

Postby clrgq » Sun Nov 20, 2011 5:22 am

and what is wrong with saying i don't know c code? I'm doing a mainframe challenge and the part that i was stuck on contained this small snippet of c code and after reading manuals i still wasn't quite sure which direction to go in. im trying to become familiar with mainframe and not knowing something is not the same thing as incompetence. i'm sure the c code gods will not be angry that i posted for assistance on a help & support forum for mainframe BEGINNERS and Students. i have no desire to be a programmer but that doesnt mean that i'm not allowed to familarize myself with it. The challenge that i am doing is in order to prepare myself for a mainframe class and i figured the more i expose myself to it the better. so i repeat, i do not know c code but i wanted the assistance of people on here who are obviously alot better with coding and more experienced. i didn't ask for a 'handout' and you did not have to do that for me if it offended you that much.
clrgq
 
Posts: 12
Joined: Tue Oct 25, 2011 4:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: palindromic primes

Postby clrgq » Sun Nov 20, 2011 6:06 am

enrico-sorichetti wrote:follow on...
no code optimization will make a bad algorithm good

OK for brute force but...

why in heaven test the even numbers ?
is somebody hoping to make a revolutiary discover in mathematics? :geek:

and why in isPrime the limit is number/2+1 instead of sqrt(number) + 1
to check if 999999 is prime it means 500000 divisions instead of 1000

meditate on elementary arithmetic... meditate

What does this even mean? instead of meditating on elementary arithmetic, let me REITERATE, i did not write this code. this is how it was presented to me and for those of us who are doing the challenge we were asked to ALTER is so that palindromic primes are only listed. it is not a c code competition.
clrgq
 
Posts: 12
Joined: Tue Oct 25, 2011 4:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: palindromic primes

Postby dick scherrer » Sun Nov 20, 2011 11:00 am

Hello,

From your point of view, what you have asked is completely appropriate.

Many here believe that asking for help when working on a contest is not playing fair (i suspect you won't agree). Especially if this "contest" might lead to employment.

Personally, i have no problem that you are not a c programmer. I'm not either. It may help someone help you if you post the logic of how you would solve the question (using pseudo-code might help). Once you have solved the problem, then real c code modification could be considered.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: palindromic primes

Postby clrgq » Mon Nov 21, 2011 7:30 pm

good point there, but this is purely an extracurricular task. i stand to win no prize, nor gain employment from this. just trying to get a better grasp on mainframes since i signed up for a course in the fall at my university.
clrgq
 
Posts: 12
Joined: Tue Oct 25, 2011 4:44 am
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to C, C++