Logo white

ADAM / AIAHTML5

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues
  • Merge Requests 14
  • Labels
  • Wiki
  • Snippets
  • AIAHTML5
  • 400-SOURCECODE
  • AIAHTML5.Web
  • libs
  • worker.js
  • push new prod code from local to AIA_Production branch. Deleted IP10 folder.
    7abfb96b
    Birendra Kumar authored
    2019-09-06 11:37:29 +0530  
    Browse Code »
worker.js 434 Bytes
Edit Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
onmessage = function (event) {
    var arguments = JSON.parse(event.data);
    run(arguments.start, arguments.end);
};
function run(start, end) {
    var n = start;

    while (n < end) {
        var k = Math.sqrt(n);
        var found = false;

        for (var i = 2; !found && i <= k; ++i) {
            found = n % i === 0;
        }

        if (!found) {
            postMessage(n.toString());
        }

        n++;
    }
}