# Palindromic Prime Numbers in Different Bases

Contents

## Introduction

For the number bases higher than decimal (base-10), letters are used for the digits. The digits up to base-36 are: “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ”.

\\ PARI/GP
\\ x = base-10 number to convert
\\ b = base to convert it to
convert_base(x, b) = {
$$\qquad$$if (x == 0, return (“0”));
$$\qquad$$my (a = “”, \\ string to store result
$$\qquad\qquad$$dig = Vec(“0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ”), \\ possible digits
$$\qquad\qquad$$n = digits(x, b)
$$\qquad$$);
$$\qquad$$for (i = 1, #n, a = concat(a, dig[n[i] + 1]));
$$\qquad$$return (a);
}
{
base = 16;
forprime (p = 0, 10^5,
$$\qquad$$my (d = digits(p, base));
$$\qquad$$if (d == Vecrev(d),
$$\qquad\qquad$$print1(convert_base(p, base), “, “);
$$\qquad$$);
);
}

## Binary (Base-2)

11, 101, 111, 10001, 11111, 1001001, 1101011, 1111111, 100000001, 100111001, 110111011, 10010101001, 10110101101, 11000100011, 11001010011, 11011111011, 11100100111, 11101010111, 1001100011001, 1001111111001, 1010001000101, 1010110110101, 1011011101101, 1011101011101, 1100001000011, 1101010101011, 1110110110111, 1111001001111, 1111011101111, 1111111111111, 100001111100001, 100011010110001, 100011101110001, 100101111101001, 100110010011001, 100110101011001, 101001010100101, 101100000001101, 101100010001101, 101100101001101, 101110000011101, 101110111011101, 110010010010011, 110010101010011, 110101000101011, 110110010011011, 110110111011011, 110111000111011, 111000010000111, 111001111100111, 111011010110111, 111100111001111, 111101111101111, 10000000000000001, 10001001010010001, 10001011111010001, 10001110001110001, 10010001010001001, 10010011111001001, 10010111111101001, 10011000000011001, 10011010101011001, 10011110001111001, 10100010101000101, 10100011011000101, 10100110001100101, 10100111011100101, 10101000100010101, 10101001010010101, 10101100000110101, 10110100100101101, 10111010101011101, 10111011111011101, 10111101110111101, 11000000100000011, 11000001010000011

## Ternary (Base -3)

2, 111, 212, 12121, 20102, 22122, 1001001, 1021201, 1111111, 1201021, 1221221, 2001002, 2021202, 2101012, 2111112, 2121212, 2201022, 2211122, 102111201, 110111011, 111212111, 121212121, 202111202, 211212112, 212010212, 221111122, 10001110001, 10002120001, 10010101001, 10012121001, 10112121101, 10201110201, 11000100011, 11002120011, 11011111011, 11012121011, 11020102011, 11022122011, 11100100111, 11120102111, 11121112111, 11200100211, 11202120211, 11211111211

## Quaternary (Base-4)

2, 3, 11, 101, 131, 323, 10001, 11311, 12121, 13031, 13331, 30103, 31013, 31313, 32023, 33133, 1003001, 1013101, 1101011, 1120211, 1123211, 1133311, 1201021, 1212121, 1221221, 1302031, 1311131, 1321231, 1322231, 3021203, 3031303, 3110113, 3133313, 3200023, 3201023, 3211123, 3212123, 3220223, 3223223, 3231323, 3301033, 3310133, 3320233, 3323233, 3332333, 100000001, 100323001, 101121101, 101222101, 101333101, 102010201, 102131201, 102202201, 103323301, 110111011, 110232011, 111010111, 111212111, 112000211, 112030211, 112101211, 112111211, 112212211, 113000311, 120101021

## Quinary (Base-5)

2, 3, 111, 131, 232, 313, 414, 10301, 12121, 13331, 14141, 20102, 20302, 23132, 24342, 31313, 32323, 33133, 34143, 34343, 40304, 41114, 42124, 43334, 44144, 1003001, 1013101, 1111111, 1123211, 1141411, 1221221, 1223221, 1241421, 1303031, 1313131, 1331331, 1411141, 1441441, 1443441, 2003002, 2011102, 2033302, 2103012, 2113112, 2131312, 2143412, 2211122, 2241422, 2243422, 2303032, 2333332, 2413142, 2421242, 2443442, 3011103, 3013103, 3031303, 3041403, 3043403, 3103013, 3123213, 3141413, 3213123, 3221223, 3231323, 3243423, 3301033, 3323233, 3343433, 3433343, 4021204, 4031304, 4043404, 4131314, 4211124, 4223224, 4233324, 4301034, 4303034, 4333334, 4343434, 4401044, 4443444

## Senary (Base-6)

2, 3, 5, 11, 101, 111, 141, 151, 515, 525, 10001, 11311, 11411, 11511, 12021, 12121, 13131, 13531, 14141, 14341, 15451, 50105, 51215, 52225, 52525, 53035, 53135, 53535, 54345, 54445, 55355, 1004001, 1005001, 1015101, 1021201, 1034301, 1041401, 1054501, 1111111, 1123211, 1133311, 1144411, 1150511, 1202021, 1203021, 1215121, 1221221, 1250521, 1252521, 1300031, 1304031, 1311131, 1313131, 1321231, 1330331, 1335331, 1343431, 1354531, 1355531, 1404041, 1411141, 1412141, 1420241, 1423241, 1443441, 1453541, 1502051, 1513151, 1522251, 1530351, 1531351, 1550551, 1555551

## Septenary (Base-7)

2, 3, 5, 131, 212, 313, 515, 535, 616, 10301, 10501, 11111, 12521, 13531, 14141, 15151, 15551, 16361, 20302, 21512, 22322, 22522, 23132, 24542, 25352, 30503, 31313, 32323, 33533, 34343, 35353, 36563, 41114, 42124, 43534, 44144, 46564, 50305, 51115, 53135, 55355, 56165, 60106, 60506, 62126, 62326, 63136, 64346, 64546, 66166

## Octal (Base-8)

2, 3, 5, 7, 111, 131, 141, 161, 323, 343, 373, 535, 565, 717, 737, 747, 767, 10301, 10601, 11511, 12421, 12621, 13031, 13331, 15151, 16561, 17471, 30403, 30503, 30703, 31313, 31713, 32023, 32323, 33433, 34343, 34443, 35053, 35353, 36463, 36563, 36763, 37473, 50105, 52125, 53135, 56165, 57375, 57675, 70207, 70307, 70607, 71217, 72627, 73237, 73337, 73537, 74547, 75657, 75757, 76067, 76367, 76567, 76667

## Nonary (Base-9)

2, 3, 5, 7, 131, 151, 212, 232, 272, 414, 454, 515, 737, 757, 838, 858, 878, 10501, 10701, 11711, 12521, 13531, 13731, 15151, 15551, 16161, 17371, 18181, 18781, 20302, 20702, 22322, 23332, 24342, 24542, 26562, 26762, 27172, 28582, 41114, 42324, 43534, 44344, 45354, 46164, 46564, 47374, 47774, 48184, 48784, 50305, 50705, 51115, 51315, 52125, 53335, 53735, 56565, 57375, 57775, 58585, 72127, 72327, 72727, 76567, 76767, 77377, 78387, 80508, 81518, 82528, 82728, 84148, 84348, 85158, 85558, 86568, 87578, 87778, 88188, 88788

## Decimal (Base-10)

2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14741, 15451, 15551, 16061, 16361, 16561, 16661, 17471, 17971, 18181, 18481, 19391, 19891, 19991, 30103, 30203, 30403, 30703, 30803, 31013, 31513, 32323, 32423, 33533, 34543, 34843, 35053, 35153, 35353, 35753, 36263, 36563, 37273, 37573, 38083, 38183, 38783, 39293, 70207, 70507, 70607, 71317, 71917, 72227, 72727, 73037, 73237, 73637, 74047, 74747, 75557, 76367, 76667, 77377, 77477, 77977, 78487, 78787, 78887, 79397, 79697, 79997, 90709, 91019, 93139, 93239, 93739, 94049, 94349, 94649, 94849, 94949, 95959, 96269, 96469, 96769, 97379, 97579, 97879, 98389, 98689

## Undecimal (Base-11)

2, 3, 5, 7, 171, 232, 353, 373, 414, 434, 494, 535, 595, 616, 656, 676, 737, 797, 838, 858, 919, 959, A1A, A7A, A9A, 10901, 11711, 13331, 13531, 14741, 15951, 16361, 18381, 19991, 1A1A1, 1A7A1, 21512, 22122, 22522, 23732, 24542, 25552, 26362, 26762, 27372, 28782, 29792, 29992, 2A3A2, 2A9A2, 30503, 30703, 31113, 31313, 32923, 33133, 33733, 34943, 35553, 36563, 37173, 37773, 37973, 3A1A3, 3A3A3, 3A7A3, 41714, 42724, 43534, 44744, 46964, 47574, 48984, 4A1A4, 50105, 51915, 54345, 56965, 58185, 58585, 58785, 5A3A5, 5A9A5, 60106, 62526, 64946, 65956, 67176, 67376

## Duodecimal (Base-12)

2, 3, 5, 7, B, 11, 111, 131, 141, 171, 181, 1B1, 535, 545, 565, 575, 585, 5B5, 727, 737, 747, 767, 797, B1B, B2B, B6B, 10301, 10401, 10601, 11111, 11411, 11511, 11811, 11911, 11A11, 11B11, 12421, 12A21, 12B21, 13631, 13831, 13931, 13A31, 13B31, 14041, 14A41, 15051, 15151, 15451, 16061, 16161, 17071, 17371, 17471, 17571, 17971, 17B71, 18381, 18681, 18881, 18A81, 18B81, 19191, 19491, 19591, 19891, 19991, 1A1A1, 1A3A1, 1A4A1, 1B0B1, 1B5B1

## Tredecimal (Base-13)

2, 3, 5, 7, B, 1B1, 212, 232, 272, 292, 313, 373, 3B3, 434, 494, 4B4, 515, 575, 595, 616, 6B6, 737, 797, 818, 838, 878, 919, 979, B9B, C1C, C7C, 11111, 12121, 12521, 12B21, 13531, 13931, 14141, 14941, 16561, 17171, 17971, 18181, 18581, 19591, 19B91, 1A3A1, 1A9A1, 1B5B1, 1C3C1, 1C5C1, 1CBC1, 23732, 24542, 25552, 26362, 27172, 27B72, 29392, 2A1A2, 2A7A2, 2ABA2, 2B5B2, 2C1C2, 2C7C2, 30503, 30703, 31513, 31913, 35753, 35953

2, 3, 5, 7, B, D, 101, 111, 131, 161, 1A1, 1D1, 323, 343, 353, 3D3, 525, 565, 585, 5C5, 919, 929, 979, 9A9, B5B, B6B, B9B, D4D, D7D, D9D, DCD, 10501, 11411, 11811, 11B11, 12021, 12121, 12921, 12A21, 13031, 13331, 13831, 13B31, 13C31, 14741, 15A51, 15C51, 16861, 17B71, 17D71, 18681, 18D81, 19991, 1A5A1, 1A7A1, 1AAA1, 1B4B1, 1B6B1, 1C3C1, 1C5C1, 1C6C1, 1C9C1, 1DAD1, 1DDD1