Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
Fewer ducks than estimates indicate.

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.

user:
pass:
register,


                                                         

Prime? button

Button on calculator to tell you if an integer is a prime number
  (+14)(+14)
(+14)
  [vote for,
against]

In my line of work I often have the task of determining equidistant spacing of series of objects, e.g. mullions in a window frame or piers in a colonnade, in such a way that the result is dimensionable on a drawing in whole millimetres (or multiples of ten, depending on the scale-order of design). This usually entails seeing what will go into a total dimension like the width of a window less one mullion thickness, and if my chosen mullion thickness is something like 57mm there is a fair chance that the total comes to a prime number.

It would save me a lot of fruitless speculation if I could simply enter the total on my calculator and get a yea or nay as regards whether or not it is a prime number. It would be better if I could also get a run-down of possible factors, e.g. 629 would return 37 17; 637 would return 19 7; 660 would return 11 5 4 3 2; 37 would return P.

Ned_Ludd, Nov 27 2007

Prime number checker http://www.math.com...ce/prime-number.htm
This should solve your problem. It's Javascript and tends to get rather slow if you enter big numbers. [marklar, Nov 27 2007]

Java Applet for Factorisation http://www.cryptogr...o.uk/factorise.html
Just a wee applet that gives you factors [Jinbish, Nov 27 2007]

Preferred Numbers http://en.wikipedia...ki/Preferred_number
How it should really be done [vincevincevince, Nov 27 2007]

[link]






       An excellent idea for small numbers [+]   

       Calculating primes is extremely hard, compared to other operations. There have only relatively recently been advances algorithms to find primes, and they work on the probability of a number being a prime, which is not what you want.   

       In order to test a prime, you have to test it against all primes of a lower value, which of course is fine for any of the numbers you mentioned and anything up to about 10 digits should be no problem for a normal calculator.
marklar, Nov 27 2007
  

       It's not really checking for prime numbers, is it?   

       Ok. It is, but you're really more interested in the factors of the given number and to be told if there aren't any.   

       However - this would be a very useful function on a calculator.
Jinbish, Nov 27 2007
  

       The engineering solution is to use preferred numbers and insist on suppliers who have products which use preferred numbers. That way your problems get very neatly solved...
vincevincevince, Nov 27 2007
  

       Ha!
pertinax, Nov 27 2007
  

       "In order to test a prime, you have to test it against all primes of a lower value" - no, just up until its square root.
4whom, Nov 27 2007
  

       I love the word "mullion".
lostdog, Nov 27 2007
  

       The problem, [vincevincevince], is that different industries have different series of preferred numbers, and it's my job to get them to work together.   

       From your link: "In the construction industry, it was felt that typical dimensions must be easy to use in mental arithmetic." I am therefore reluctant to tell a contractor to build columns at 3627mm centres. Because there is a sort of "customary tacit tolerance" in the building industry I can't police a dimension like that the way I can a dimension of 3600mm. Nor can I verify that drawings done by subordinates are correct without doing a lot of math. I consequently spend a lot of time finding rhythms that allow both regular spacings and sensible dimensions.   

       A factorization facility would make that a lot simpler, and a prime-number alert would warn me not to pursue impossibilities.
Ned_Ludd, Nov 27 2007
  

       That preferred number stuff is interesting. Another reminder that the making of buildings is rather tricky, a fact I am reminded of daily.   

       By-the-by, if anyone finds the body of a Romanian contractor floating in the Thames tomorrow, is has nothing to do with the continuing non-arrival of my glass balustrade.
wagster, Nov 27 2007
  

       + good
xandram, Nov 27 2007
  

       TI-89 has this capability.
quantum_flux, Nov 28 2007
  

       Be calm, [wagster]. If you get too stressed, just imagine yourself trying to choose character witnesses from among your fellow half-bakers.
lurch, Nov 28 2007
  

       Cool, but I've got to know...whas it easier to make your second mullion than your first?   

       [wagster], the first rule is, never programme a construction process so that it'll be done by Christmas. November is not a time to fit balustrades. November is a time to fit first-fix plumbing and electrics. Your solution is called February. Take a deep breath, sigh a bit if you want, and embrace it.
Ned_Ludd, Nov 28 2007
  

       //TI-89 has this capability//   

       Dang! But my TI-85 looks *way* cooler.
Jinbish, Nov 28 2007
  

       ...but you also have to consider with width of the mullions so that you can specify glass to be cut in sensible dimensions don't you? I recently had a similar problem in which wanted to hang two similarly-sized pictures on a wall such that the gap between the two pictures was the same as the gaps between the pictures and the ends of the wall - you have to place the hooks (width of picture/2) + ((width of wall - (2*width of picture))/3) from the ends of the wall...
hippo, Nov 28 2007
  

       This is why i love the halfbakery. I can barely understand a word of any of this.
Murdoch, Nov 28 2007
  

       //I can barely understand a word of any of this//   

       You come for the ideas. You stay for the pastry.
Jinbish, Nov 28 2007
  

       There could be a ROM chip storing a sieve of Erastosthenes for integers up to a certain level as single-bit flags. The operand could be used as an address.
nineteenthly, Nov 28 2007
  

       A prime? button would be of use to me even without factorization. I get an odd number that doesn't end in 5, and the sum of whose whose digits is not divisible by 3. Do I bother looking for sensible factors? Or do I rather redesign so the total is 10mm more or 10mm less?
Ned_Ludd, Nov 28 2007
  

       What [nineteently] said. About the erastophanes operands 'n stuff.   

       [Ned] - the builders leave today - it's all done, right down to the houseplants and the bedding that matches the wallpaper. But you can still fall two stories out of the bedrooms.
wagster, Nov 28 2007
  

       There's also something about only having to search up to the square root of an integer which apparently simplifies things, but i can't remember it. Also, the ROM could fit in twice as many numbers if all the even ones were missed out and the result was shifted one bit to the left afterwards, with the proviso that the number two was returned from the function as true automatically, so:   

       If x=2 then set flag to true and exit;
If x is even then set flag to false and exit;
Increment x;
Shift x right one bit, look it up in the ROM, then return the bit at the appropriate address.
nineteenthly, Nov 28 2007
  

       I thought this was going to be about IV or feeding tube pumps.
BJS, Nov 28 2007
  

       Brilliant, thanks [boysparks], i was wondering about that for a long time.
nineteenthly, Nov 28 2007
  

       I wrote "factor finder" in Applesoft many years ago. Iterations are so fast now that this would not be hard to do with brute force, especially in smaller numbers such as those used in construction. I am not sure if calculators have the ability to do something like this, but it certainly could be done using basic or even an excel spreadhseet, if a laptop is handy.   

       But maybe a guy called Ned_Ludd is intolerant of laptops. I am not sure if a slide rule can be used to find factors.
bungston, Nov 28 2007
  

       It seems to me that the idea of "prime"-ness is a purely digital creation. If you want something divided into n segments, draw n segments on a piece of paper, put it in a projector, and adjust it to subtend the distance you wanted to divide. There's your segments. O'course, the gods of small close-fitted stones may inadequately defend you if you try to pass the resultant measure off on a vendor.
lurch, Nov 28 2007
  
      
[annotate]
  


 

back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle