MasterDev Puzzel

Puzzel voor de MasterDev

HTML

<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<h1>MasterDev Puzzel</h1>
<p>Welkom bij de MasterDev Puzzel. Deze puzzel is onderdeel van de aanmeldprocedure voor de MasterDev</p>
<ol>
  <li>Implementeer de <code>isPriemgetal</code> functie zodat deze <code>true</code> retourneert indien het meegegeven getal een priemgetal is.</li>
  <li>(Optioneel) Sorteer het resultaat van priem naar niet-priem en van klein naar groot.</li>
  <li>Vermeld de link naar je oplossing in het registratieformulier.</li>
</ol>
<table class="table">
  <thead>
    <tr>
      <th>#</th>
      <th>Getal</th>
      <th>Resultaat</th>
    </tr>
  </thead>
  <tbody data-bind="foreach: nummers">
    <tr data-bind="css: { success: isPriemgetal, danger: !isPriemgetal }">
      <td data-bind="text: $index"></td>
      <td data-bind="text: getal"></td>
      <td>
        <span data-bind="visible: isPriemgetal">Priemgetal!</span>
        <span data-bind="visible: !isPriemgetal">Geen priemgetal</span>
      </td>
    </tr>
  </tbody>
</table>

JavaScript

function isPriemgetal(n) {
  return true; // Implementatie gaat hier
}

var data = [258492, 276329, 201355, 945699, 670362, 775452, 940982, 86568, 459788, 485540, 511700, 981971, 408588, 461995, 170879, 461958, 304846, 511336, 273795, 99621, 229683, 949847, 146010, 540530, 613700, 790694, 117190, 956425, 358289, 295111, 564930, 783014, 227060, 797572, 212371, 268084, 783888, 917676, 714083, 188798, 325877, 397516, 695852, 820574, 735326, 764281, 120014, 980698, 951440, 916245, 298137, 532487, 519851, 750240, 332445, 580268, 488237, 818453, 918723, 334382, 35393, 44295, 842773, 94754, 96529, 967955, 30427, 293861, 977209, 958125, 932344, 532646, 854041, 721755, 826443, 4105, 375889, 55387, 397324, 839980, 612331, 267002, 543228, 968310, 499374, 658307, 340890, 84280, 23733, 94003, 181878, 973140, 771979, 404115, 827130, 283243, 873858, 120079, 890643, 825261, 51395, 283359, 925349, 373864, 512191, 569753, 419482, 39540, 372954, 186119, 437778, 965513, 579872, 27478, 147938, 869428, 433147, 171730, 823948, 430444, 436549, 944917, 196524, 553764, 130447, 490047, 860111, 17196, 456300, 977855, 637032, 305358, 880138, 375124, 506291, 787656, 370261, 175433, 308230, 635813, 252350, 865728, 946541, 954383, 470821, 498515, 34668, 679661, 40326, 383997, 233792, 501334, 134244, 887225, 449555, 81548, 292626, 841791, 994576, 940563, 19823, 141698, 696116, 816702, 804503, 812890, 207301, 157628, 69950, 853330, 369221, 900825, 557329, 501751, 506765, 501986, 645208, 872429, 163457, 74653, 460909, 173021, 190269, 608009, 47086, 558334, 367598, 398566, 771680, 961147, 871531, 261559, 230607, 769516, 288279, 957329, 317098, 203217, 416600, 299829, 529300, 325598, 300015, 360206, 792295, 169520, 260484, 141121, 506001, 582962, 830773, 507145, 617944, 528991, 897450, 26879, 295547, 907698, 27473, 404912, 23227, 503789, 223092, 624026, 82345, 834724, 900118, 554795, 737016, 186471, 486534, 526550, 724563, 552559, 680351, 638205, 741034, 71361, 315957, 4110, 157996, 724265, 763042,...