to your HTML Add class="sortable" to any table you'd like to make sortable Click on the headers to sort Thanks to many, many people for contributions and suggestions. Licenced as X11: http://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ var stIsIE = /*@cc_on!@*/false; sorttable = { init: function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); if (!document.createElement || !document.getElementsByTagName) return; sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { sorttable.makeSortable(table); } }); }, makeSortable: function(table) { if (table.getElementsByTagName('thead').length == 0) { // table doesn't have a tHead. Since it should have, create one and // put the first table row in it. the = document.createElement('thead'); the.appendChild(table.rows[0]); table.insertBefore(the,table.firstChild); } // Safari doesn't support table.tHead, sigh if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; if (table.tHead.rows.length != 1) return; // can't cope with two header rows // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as // "total" rows, for example). This is B&R, since what you're supposed // to do is put them in a tfoot. So, if there are sortbottom rows, // for backwards compatibility, move them to tfoot (creating it if needed). sortbottomrows = []; for (var i=0; i
Can you quickly tell if a number is divisible by any of the numbers from 1 to 12 without actually doing the division?
Let's say you have the number 1,512 and it be really helpful if you could determine if it could be evenly divided by any of the numbers from 1 to 12. Could you do it without launching the calculator app on your mobile phone and performing the divisions?
You can, but you'll need to apply the divisibility rules you might have learned a long time ago in school. In case you don't remember them, here they are, where we've included one or two you may never have seen before. Try them with 1,512 and see which apply....
The divisibility rule for 7 is an example of the right-trim method, which may be applied in performing divisibility tests for larger values, provided you know what to multiply the right-most digit of your test number by in applying that process. In the case of 7, you can also apply it by multiplying the right-most digit of your number by 2 and subtracting that result from the remaining left-side of your number - there's more than one way you can make it work to find out if your test number is divisible by 7.
Going back to the number 1,512, hopefully, you found that it is divisible by 1, 2, 3, 4, 6, 7, 8, 9, and 12. If you're looking for a challenge, try 5,856,519,049,581,039. And if you are looking for more divisibility rules for larger numbers, keep reading....
Now, what about divisibility rules for numbers bigger than 12? For most of these numbers, the right trim method provides a relatively simple and effective means to determine if these numbers can evenly divide into your number of interest. Provided you know what multiplier to apply in using it.
At the same time, you may also recognize from the rules we presented for divisors from 1 to 12 that you don't get a whole lot of extra mileage in having divisibility rules for conjugate numbers, or rather, those values that are already the products of two or more smaller factors. For example, you can simply perform the tests for 2 and 7 to determine if a number is wholly divisible by 14. Or you could perform the tests for 3 and 11 to determine if your number is divisible by 33.
From a practical perspective then, if you're trying to tell if a given value is divisible by a smaller number, you only need to apply the divisibility rules that apply for prime numbers, which you can combine together as you might need to conduct divisibility tests for non-prime number divisors.
That brings us to the following tool, which we've constructed to identify the multiplier that you would need to successfully apply the single digit right trim method with your number of interest. Just enter the prime number for which you want to identify a multiplier, and it will provide you the number you need.
Technically, the tool above will work to identify valid right trim method multipliers for any value you enter whose final digit is 1, 3, 7 or 9, which coincidentally happens to include all prime numbers greater than 5. Speaking of which, here are lists of the first fifty million prime numbers, which should keep you busy for a while for your divisibility tests!
Image credit: Gayatri Malhotra
Welcome to the blogosphere's toolchest! Here, unlike other blogs dedicated to analyzing current events, we create easy-to-use, simple tools to do the math related to them so you can get in on the action too! If you would like to learn more about these tools, or if you would like to contribute ideas to develop for this blog, please e-mail us at:
ironman at politicalcalculations
Thanks in advance!
Closing values for previous trading day.
This site is primarily powered by:
The tools on this site are built using JavaScript. If you would like to learn more, one of the best free resources on the web is available at W3Schools.com.