Jump to content

Prime Number Challange


Recommended Posts

One Challange for Everyone!!!!!!

I have one random number...which i have to find that the number is prime or not....

suppose I have 125 number...now i need to check the number is prime or not..how can I know?..

can anybody send me a sample VI for that?..

One more request that plz dont send the repeated VI as in NI..

Also i know that Prime numbers are those which are only divisible by only two numbers: 1 and the number itself...

Sahara

Link to comment

QUOTE(Justin Goeres @ Oct 31 2007, 02:51 PM)

Didn't we just cover this in another thread a few days ago?

EDIT: Oh, look! http://forums.lavag.org/Need-to-Solve-Two-Problems-t9333.html' target="_blank">We did! And the original topic starter was sahara that time, too. The problem wasn't exactly the same, but it was close enough that I'd think anybody who solved that problem (or used the pointers we provided) would be able to solve this one.

Well in that case I'll wait for a real challenge. Something like...

Use the 3d Picture control to develop a robotic frame that can be outfit with user designed weapons and armor and who's motion and behaviour are offered as services that a user specified VI can utilize to control the motion and behaviour.

That way we can have virtual robot wars and fight over who is the meanest LV developer.

Bonus points awarded for tracking and animating parts that fall of durring battle.

Ben

Link to comment

QUOTE(neB @ Oct 31 2007, 01:09 PM)

Use the 3d Picture control to develop a robotic frame that can be outfit with user designed weapons and armor and who's motion and behaviour are offered as services that a user specified VI can utilize to control the motion and behaviour.

As long as we're brainstorming...

I propose Scripting Fight. A reference to a blank VI is passed to two different VIs running in parallel. These two VIs (each written by a different individual) should compete to accomplish some block diagram goal while preventing the other VI from accomplishing the same goal. The "winner" is the VI that, after a certain time period or number of nodes, is closer to the goal by some metric (functionality, aesthetics, etc.).

Link to comment

QUOTE(Justin Goeres @ Oct 31 2007, 10:54 PM)

I propose Scripting Fight. A reference to a blank VI is passed to two different VIs running in parallel. These two VIs (each written by a different individual) should compete to accomplish some block diagram goal while preventing the other VI from accomplishing the same goal. The "winner" is the VI that, after a certain time period or number of nodes, is closer to the goal by some metric (functionality, aesthetics, etc.).

This Script Wars proposal of yours sounds interesting. How about making the fighting VIs evolve autonomously so that they constantly become better and better without human intervention. Perhaps LAVA should have a few script wars servers so that we could start fighting...

Fact of the day: LabVIEW 8.5 scripting has 257 classes, 1118 method names and 3214 property names. Do already you know them all?

Link to comment

QUOTE(eaolson @ Oct 31 2007, 10:30 PM)

Yes, I am the same person and I had post the nearby problem before some day ago..

Though I m new one in LabVIEW, still i m searching of an answer..so plz can anybody tells me to check the number is prime or not..that will be enough for me at this stage..bz i have not reached at level that i can solved the challange which was given by some person here..

plz help me out to know the answer of prime number.

Thanking you

Sahara

Link to comment

QUOTE(Justin Goeres @ Oct 31 2007, 03:54 PM)

As long as we're brainstorming...

This is really interesting. However, why not try to do better than just fighting, which seems to often get lots of people in trouble. Why not a vi which can find the capabilities required in the specification and add them in to a started-off-blank VI.

For example if the specification called for a prime_number test on a particular wire then the "scripting cooperator" would locate our origianal poster's homework and slip it in.

Link to comment

QUOTE(sahara agrasen @ Oct 31 2007, 09:19 PM)

Then I will start again.

In reply #71 of the thread found at this URL

http://forums.ni.com/ni/board/message?boar...=146233#M146233

I posted an example that finds prime numbers using the brute force approach of trial and error.

It also takes into concideration that that largest number that is worth attempting to divide a number by is its square root.

Other that that, it is straight forward.

Please look at that code and then ask follow-up questions.

BACK TO THE FIGHT!

I am game to keep these battle ideas going but I'd like to make an observation.

THese ideas are tending toward the complicated side and few of us are going to be able to do it all individually (Norm excluded).

So what about turning these ideas into a multi-phase project and proceed using the Unified Process of breaking it down into simple steps that lead to our end goal.

Just tossing out ideas,

Ben

Link to comment

QUOTE(Justin Goeres @ Oct 31 2007, 09:54 PM)

As long as we're brainstorming...

Perhaps simpler code challenges for when we get asked 'homework' type questions:

* The worst LabVIEW style solution - who can come up with the solution that whilst actually doing the correct thing without bugs like race conditions is executed in the worst possible style - I'm thinking multiple nested sequences and loops with sub-vis and wires that sit on top of each, wires that run right to left, daft connector pane patterns, the full works.

* The most obfuscated solution - again, a solution that actually works and is bug free, this time written in technically good stlye, but with hardest to follow and least obvious algorithm.

I'm thinking about solutions that will score a nice big zero mark but do actually work. Or am I just too evil ;)

Link to comment

QUOTE(Gavin Burnell @ Nov 1 2007, 03:30 PM)

Perhaps simpler code challenges for when we get asked 'homework' type questions:

* The worst LabVIEW style solution - who can come up with the solution that whilst actually doing the correct thing without bugs like race conditions is executed in the worst possible style - I'm thinking multiple nested sequences and loops with sub-vis and wires that sit on top of each, wires that run right to left, daft connector pane patterns, the full works.

* The most obfuscated solution - again, a solution that actually works and is bug free, this time written in technically good stlye, but with hardest to follow and least obvious algorithm.

I'm thinking about solutions that will score a nice big zero mark but do actually work. Or am I just too evil ;)

Or go for a more long term solution. Develop some hidden code and insert it into the solution (which can follow the above methods as well, if so desired ;) ). This hidden code will display a popup window stating "If grading my homework, give me an 'F' please." However, this popup will only show up if the VI is modified by the teacher in a specified way. This could be easily done using VI Tags, for instance.

The hard part would be getting the VI to do the modifying to the professors using LabVIEW, but it would be really cool nonetheless.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.