Comments on A036937 (and A069841) Date: Sat, 20 Apr 2002 15:51:57 -0500 From: "Robert G. Wilson v" Organization: Kansas Paint & Color Co. I rewrote the routine by counting in binary and then adding 2 to each binary digit and then making it decimal, thus saving many false numbers. I am rather proud of this routine. I was able to do in moments what took my several hours yesterday. Mathematica program: Do[p = 2(10^n - 1)/9; k = 0; While[! PrimeQ[p], k++; p = FromDigits[ PadLeft[ IntegerDigits[k, 2], n] + 2]]; Print[p], {n, 1, 30}] The sequence for n = 1 to 121 is: 2 23 223 2333 23333 222323 2222333 22222223 222323333 2222232323 22222222223 222222333323 2222222222323 22222222223323 222222222332233 2222222222323223 22222222222233323 222222222222233323 2222222222222233333 22222222222222232233 222222222222222322223 2222222222222222222333 22222222222222222223323 222222222222222222233333 2222222222222222222232233 22222222222222222223222233 222222222222222222222233233 2222222222222222222223233323 22222222222222222222222233223 222222222222222222222222323233 2222222222222222222222222223223 22222222222222222222222222332223 222222222222222222222222222222323 2222222222222222222222222223232223 22222222222222222222222222223222233 222222222222222222222222222222222223 2222222222222222222222222222223233233 22222222222222222222222222222222232323 222222222222222222222222222222223333223 2222222222222222222222222222222223232223 22222222222222222222222222222222222223333 222222222222222222222222222222222232232323 2222222222222222222222222222222222222232233 22222222222222222222222222222222222232322223 222222222222222222222222222222222222222232333 2222222222222222222222222222222222222223332333 22222222222222222222222222222222222222222233223 222222222222222222222222222222222222222223323233 2222222222222222222222222222222222222222223332323 22222222222222222222222222222222222222222222323233 222222222222222222222222222222222222222222222223223 2222222222222222222222222222222222222222222223332323 22222222222222222222222222222222222222222222222223323 222222222222222222222222222222222222222222222223232323 2222222222222222222222222222222222222222222222222332333 22222222222222222222222222222222222222222222222232222233 222222222222222222222222222222222222222222222222222223223 2222222222222222222222222222222222222222222222222222222333 22222222222222222222222222222222222222222222222222222333223 222222222222222222222222222222222222222222222222222222232223 2222222222222222222222222222222222222222222222222222232232223 22222222222222222222222222222222222222222222222222222223223223 222222222222222222222222222222222222222222222222222222222232223 2222222222222222222222222222222222222222222222222222222322323323 22222222222222222222222222222222222222222222222222222222322332223 222222222222222222222222222222222222222222222222222222222232233323 2222222222222222222222222222222222222222222222222222222222323232323 22222222222222222222222222222222222222222222222222222222222323322333 222222222222222222222222222222222222222222222222222222222222222322333 2222222222222222222222222222222222222222222222222222222222222323323323 22222222222222222222222222222222222222222222222222222222222222223222323 222222222222222222222222222222222222222222222222222222222222222222232333 2222222222222222222222222222222222222222222222222222222222222222222223223 22222222222222222222222222222222222222222222222222222222222222222233323233 222222222222222222222222222222222222222222222222222222222222222222222233233 2222222222222222222222222222222222222222222222222222222222222222222222222333 22222222222222222222222222222222222222222222222222222222222222222223222232223 222222222222222222222222222222222222222222222222222222222222222222222232333333 2222222222222222222222222222222222222222222222222222222222222222222222222323333 22222222222222222222222222222222222222222222222222222222222222222222222332323333 222222222222222222222222222222222222222222222222222222222222222222222222322223323 2222222222222222222222222222222222222222222222222222222222222222222222222222223323 22222222222222222222222222222222222222222222222222222222222222222222222222222323223 222222222222222222222222222222222222222222222222222222222222222222222222222322233233 2222222222222222222222222222222222222222222222222222222222222222222222222222222223323 22222222222222222222222222222222222222222222222222222222222222222222222222222322333333 222222222222222222222222222222222222222222222222222222222222222222222222222222222322223 2222222222222222222222222222222222222222222222222222222222222222222222222222222222233333 22222222222222222222222222222222222222222222222222222222222222222222222222222222322223323 222222222222222222222222222222222222222222222222222222222222222222222222222222223223323333 2222222222222222222222222222222222222222222222222222222222222222222222222222222222233222333 22222222222222222222222222222222222222222222222222222222222222222222222222222222222323223223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222233232323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222232222323 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323223323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223233 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232223223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233232323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232323323 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223323323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232233323 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223222323223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232223 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223332333 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223333323 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323233 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232223223 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223222323 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232332323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222232333223 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222322323 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223223323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222333333323 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223222232223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223232323 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222332322233 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223232223 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222223222333223 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222332333 Maybe more instructive is the size of the binary number that we have to go to, to get a prime number of this form. Remember that my iterator "k" in expressed here in decimal: 0, 1, 1, 7, 15, 5, 7, 1, 47, 21, 1, 61, 5, 13, 51, 41, 29, 29, 31, 19, 33, 7, 13, 31, 19, 67, 27, 93, 25, 43, 9, 49, 5, 81, 67, 1, 91, 21, 121, 81, 15, 149, 19, 161, 23, 119, 25, 107, 117, 43, 9, 117, 13, 85, 55, 131, 9, 7, 57, 17, 145, 73, 17, 301, 305, 157, 341, 359, 39, 365, 69, 23, 9, 235, 27, 7, 529, 191, 47, 431, 269, 13, 41, 283, 13, 319, 33, 31, 269, 623, 199, 329, 213, 133, 1, 333, 11, 137, 213, 173, 1, 109, 157, 553, 17, 119, 125, 43, 137, 69, 181, 185, 37, 77, 509, 529, 85, 419, 81, 569, 55, 293, 463, 261, 15, 87, 137, 1, 325, 359, 39, 143, 721, 1763, 177, 107, 57, 65, 217, 97, 987, 407, 119, 171, 5, 923, 117, 261, 389, 79, 11, 311, 267, 103, 277, 61, 33, 739, 195, 205, 13, 471, 485, 21, 115, 327, 27, 77, 157, 491, 199, 115, 387, 171, 119, 517, 87, 271, 37, 331, 63, 263, 299, 7, 69, 583, 371, 69, 451, 887, 147, 43, 627, 1111, 1451, 1019, 1307, 949, 529, 323, 129, 793, 349, 107, 47, 35, 127, 385, 797, 339, 295, 959, 149, 665, 317, 23, 729, 797, 631, 7, 1015, 89, 181, 667, 109, 173, 51, 191, 479, 851, 1051, 1471, 125, 333, 9, 1029, 239, 541, 13, 575, 31, 631, 1715, 173, 119, 87, 265, 1273, 191, 133, (This is A069841) So far the largest k is 1763, and in binary that is 11011100011 or just eleven binary places in numbers that now exceed 250 places.