Editorial for Số nguyên tố ghép

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Lưu ý: Các code mẫu dưới đây chỉ mang tính tham khảo và có thể không AC được bài tập này

Code mẫu của flashmt

const fi='';
fo='';
maxn=427999;
var d:array[2..maxn] of boolean;
p:array[0..50000] of qword;
pow:array[1..6] of qword;
b:array[0..1] of longint;
n,i:longint;
kt:boolean;
a:qword;

procedure prime;
var i,j,t:longint;
begin
t:=trunc(sqrt(maxn));
for i:=3 to t do
if not d[i] then
begin
j:=i*i;
while j<=maxn do
begin
d[j]:=true;
j:=j+2*i;
end;
end;
p[0]:=1; p[1]:=2;
for i:=1 to maxn shr 1 do
if not d[i shl 1+1] then
begin
inc(p[0]);
p[p[0]]:=i shl 1+1;
end;
end;

function check(a:qword):boolean;
var i:longint; k:qword;
begin
check:=true;
k:=trunc(sqrt(a));
for i:=1 to p[0] do
if p[i]>k then exit
else
if a mod p[i]=0 then
begin
check:=false;
exit;
end;
end;

function try(x:longint):boolean;
var s:string; i,j,l:longint;
begin
try:=false;
if (p[x]+p[x+1]) mod 3=0 then exit;
str(p[x+1],s);
l:=length(s);
a:=p[x+1]+p[x]*pow[l];
str(a,s);
l:=length(s);
b[1]:=0; b[0]:=0;
for i:=1 to l do
inc(b[i and 1],ord(s[i])-48);
if abs(b[0]-b[1]) mod 11=0 then exit;
try:=check(a);
end;

begin
assign(input,fi); reset(input);
assign(output,fo); rewrite(output);
prime;
pow[1]:=10;
for i:=2 to 6 do pow[i]:=pow[i-1]*10;
i:=1;
while n>0 do
begin
repeat
kt:=try(i);
i:=i+2;
if kt then break;
until false;
dec(n);
end;
writeln(a);
close(input); close(output);
end.


Code mẫu của happyboy99x

#include <cstdio>
int main() {
int k; scanf( "%d", &k );
switch(k) {
case 1: printf("23"); break;
case 2: printf("3137"); break;
case 3: printf("8389"); break;
case 4: printf("157163"); break;
case 5: printf("167173"); break;
case 6: printf("233239"); break;
case 7: printf("257263"); break;
case 8: printf("331337"); break;
case 9: printf("353359"); break;
case 10: printf("467479"); break;
case 11: printf("509521"); break;
case 12: printf("523541"); break;
case 13: printf("653659"); break;
case 14: printf("661673"); break;
case 15: printf("677683"); break;
case 16: printf("727733"); break;
case 17: printf("11871193"); break;
case 18: printf("12011213"); break;
case 19: printf("12591277"); break;
case 20: printf("13671373"); break;
case 21: printf("14531459"); break;
case 22: printf("16691693"); break;
case 23: printf("17091721"); break;
case 24: printf("17411747"); break;
case 25: printf("21792203"); break;
case 26: printf("22072213"); break;
case 27: printf("22812287"); break;
case 28: printf("23332339"); break;
case 29: printf("26212633"); break;
case 30: printf("26712677"); break;
case 31: printf("28972903"); break;
case 32: printf("29632969"); break;
case 33: printf("30673079"); break;
case 34: printf("32593271"); break;
case 35: printf("36373643"); break;
case 36: printf("37613767"); break;
case 37: printf("40994111"); break;
case 38: printf("43974409"); break;
case 39: printf("46034621"); break;
case 40: printf("46794691"); break;
case 41: printf("47334751"); break;
case 42: printf("47594783"); break;
case 43: printf("49194931"); break;
case 44: printf("55575563"); break;
case 45: printf("59275939"); break;
case 46: printf("63536359"); break;
case 47: printf("69776983"); break;
case 48: printf("73937411"); break;
case 49: printf("75837589"); break;
case 50: printf("78237829"); break;
case 51: printf("78837901"); break;
case 52: printf("79077919"); break;
case 53: printf("87618779"); break;
case 54: printf("90679091"); break;
case 55: printf("91879199"); break;
case 56: printf("92219227"); break;
case 57: printf("92939311"); break;
case 58: printf("96019613"); break;
case 59: printf("97699781"); break;
case 60: printf("98519857"); break;
case 61: printf("1086110867"); break;
case 62: printf("1139311399"); break;
case 63: printf("1171911731"); break;
case 64: printf("1254712553"); break;
case 65: printf("1272112739"); break;
case 66: printf("1303713043"); break;
case 67: printf("1361313619"); break;
case 68: printf("1424314249"); break;
case 69: printf("1474714753"); break;
case 70: printf("1519915217"); break;
case 71: printf("1524115259"); break;
case 72: printf("1537715383"); break;
case 73: printf("1560115607"); break;
case 74: printf("1574915761"); break;
case 75: printf("1576715773"); break;
case 76: printf("1641116417"); break;
case 77: printf("1669316699"); break;
case 78: printf("1674116747"); break;
case 79: printf("1678716811"); break;
case 80: printf("1693116937"); break;
case 81: printf("1729917317"); break;
case 82: printf("1753917551"); break;
case 83: printf("1795917971"); break;
case 84: printf("1832918341"); break;
case 85: printf("1843318439"); break;
case 86: printf("1871918731"); break;
case 87: printf("1901319031"); break;
case 88: printf("1921319219"); break;
case 89: printf("1928919301"); break;
case 90: printf("1957719583"); break;
case 91: printf("1986119867"); break;
case 92: printf("1991319919"); break;
case 93: printf("2071920731"); break;
case 94: printf("2116321169"); break;
case 95: printf("2140121407"); break;
case 96: printf("2191121929"); break;
case 97: printf("2205122063"); break;
case 98: printf("2217122189"); break;
case 99: printf("2275122769"); break;
case 100: printf("2287722901"); break;
case 101: printf("2380123813"); break;
case 102: printf("2385723869"); break;
case 103: printf("2404924061"); break;
case 104: printf("2407124077"); break;
case 105: printf("2409724103"); break;
case 106: printf("2415124169"); break;
case 107: printf("2425124281"); break;
case 108: printf("2511125117"); break;
case 109: printf("2512125127"); break;
case 110: printf("2517125183"); break;
case 111: printf("2544725453"); break;
case 112: printf("2545725463"); break;
case 113: printf("2566725673"); break;
case 114: printf("2584925867"); break;
case 115: printf("2617726183"); break;
case 116: printf("2632126339"); break;
case 117: printf("2639326399"); break;
case 118: printf("2650126513"); break;
case 119: printf("2653926557"); break;
case 120: printf("2672326729"); break;
case 121: printf("2678326801"); break;
case 122: printf("2729927329"); break;
case 123: printf("2750927527"); break;
case 124: printf("2831928349"); break;
case 125: printf("2880728813"); break;
case 126: printf("2892728933"); break;
case 127: printf("2933329339"); break;
case 128: printf("3051730529"); break;
case 129: printf("3088130893"); break;
case 130: printf("3101331019"); break;
case 131: printf("3105131063"); break;
case 132: printf("3165731663"); break;
case 133: printf("3179931817"); break;
case 134: printf("3234132353"); break;
case 135: printf("3247932491"); break;
case 136: printf("3260332609"); break;
case 137: printf("3283332839"); break;
case 138: printf("3291132917"); break;
case 139: printf("3350333521"); break;
case 140: printf("3360133613"); break;
case 141: printf("3362333629"); break;
case 142: printf("3459134603"); break;
case 143: printf("3468734693"); break;
case 144: printf("3496334981"); break;
case 145: printf("3526735279"); break;
case 146: printf("3559735603"); break;
case 147: printf("3596335969"); break;
case 148: printf("3699737003"); break;
case 149: printf("3736337369"); break;
case 150: printf("3751137517"); break;
case 151: printf("3765737663"); break;
case 152: printf("3925139293"); break;
case 153: printf("3930139313"); break;
case 154: printf("3955139563"); break;
case 155: printf("3986339869"); break;
case 156: printf("4017740189"); break;
case 157: printf("4028940343"); break;
case 158: printf("4045940471"); break;
case 159: printf("4059140597"); break;
case 160: printf("4060940627"); break;
case 161: printf("4073940751"); break;
case 162: printf("4099341011"); break;
case 163: printf("4122141227"); break;
case 164: printf("4204342061"); break;
case 165: printf("4233142337"); break;
case 166: printf("4245142457"); break;
case 167: printf("4246742473"); break;
case 168: printf("4273742743"); break;
case 169: printf("4354343573"); break;
case 170: printf("4402144027"); break;
case 171: printf("4402944041"); break;
case 172: printf("4450144507"); break;
case 173: printf("4475344771"); break;
case 174: printf("4508345119"); break;
case 175: printf("4543345439"); break;
case 176: printf("4555745569"); break;
case 177: printf("4582745833"); break;
case 178: printf("4615346171"); break;
case 179: printf("4752147527"); break;
case 180: printf("4756347569"); break;
case 181: printf("4801748023"); break;
case 182: printf("4887148883"); break;
case 183: printf("4922349253"); break;
case 184: printf("4952349529"); break;
case 185: printf("4987149877"); break;
case 186: printf("5017750207"); break;
case 187: printf("5022150227"); break;
case 188: printf("5042350441"); break;
case 189: printf("5077750789"); break;
case 190: printf("5125751263"); break;
case 191: printf("5148151487"); break;
case 192: printf("5185351859"); break;
case 193: printf("5230152313"); break;
case 194: printf("5296752973"); break;
case 195: printf("5371953731"); break;
case 196: printf("5377753783"); break;
case 197: printf("5413354139"); break;
case 198: printf("5443754443"); break;
case 199: printf("5466754673"); break;
case 200: printf("5479954829"); break;
case 201: printf("5584355849"); break;
case 202: printf("5609356099"); break;
case 203: printf("5626956299"); break;
case 204: printf("5668156687"); break;
case 205: printf("5704757059"); break;
case 206: printf("5773157737"); break;
case 207: printf("5780357809"); break;
case 208: printf("5856758573"); break;
case 209: printf("5922159233"); break;
case 210: printf("5956159567"); break;
case 211: printf("5995159957"); break;
case 212: printf("6001760029"); break;
case 213: printf("6147161483"); break;
case 214: printf("6172361729"); break;
case 215: printf("6242362459"); break;
case 216: printf("6336163367"); break;
case 217: printf("6337763389"); break;
case 218: printf("6346763473"); break;
case 219: printf("6352763533"); break;
case 220: printf("6362963647"); break;
case 221: printf("6401364019"); break;
case 222: printf("6428364301"); break;
case 223: printf("6479364811"); break;
case 224: printf("6512365129"); break;
case 225: printf("6541365419"); break;
case 226: printf("6555765563"); break;
case 227: printf("6599366029"); break;
case 228: printf("6654166553"); break;
case 229: printf("6665366683"); break;
case 230: printf("6728967307"); break;
case 231: printf("6742167427"); break;
case 232: printf("6744767453"); break;
case 233: printf("6796767979"); break;
case 234: printf("6809968111"); break;
case 235: printf("6817168207"); break;
case 236: printf("6843768443"); break;
case 237: printf("6896368993"); break;
case 238: printf("6903169061"); break;
case 239: printf("6959369623"); break;
case 240: printf("7006770079"); break;
case 241: printf("7048170487"); break;
case 242: printf("7134771353"); break;
case 243: printf("7184971861"); break;
case 244: printf("7230772313"); break;
case 245: printf("7268972701"); break;
case 246: printf("7290172907"); break;
case 247: printf("7330973327"); break;
case 248: printf("7352373529"); break;
case 249: printf("7354773553"); break;
case 250: printf("7369373699"); break;
case 251: printf("7370973721"); break;
case 252: printf("7382373847"); break;
case 253: printf("7396173973"); break;
case 254: printf("7402174027"); break;
case 255: printf("7407174077"); break;
case 256: printf("7409374099"); break;
case 257: printf("7435774363"); break;
case 258: printf("7445374471"); break;
case 259: printf("7450974521"); break;
case 260: printf("7474774759"); break;
case 261: printf("7521175217"); break;
case 262: printf("7532375329"); break;
case 263: printf("7552775533"); break;
case 264: printf("7598375989"); break;
case 265: printf("7625376259"); break;
case 266: printf("7828378301"); break;
case 267: printf("7869178697"); break;
case 268: printf("7975779769"); break;
case 269: printf("8016780173"); break;
case 270: printf("8031780329"); break;
case 271: printf("8042980447"); break;
case 272: printf("8065180657"); break;
case 273: printf("8098981001"); break;
case 274: printf("8134381349"); break;
case 275: printf("8214182153"); break;
case 276: printf("8340183407"); break;
case 277: printf("8343183437"); break;
case 278: printf("8401184017"); break;
case 279: printf("8413184137"); break;
case 280: printf("8482784857"); break;
case 281: printf("8510985121"); break;
case 282: printf("8551785523"); break;
case 283: printf("8560785619"); break;
case 284: printf("8579385817"); break;
case 285: printf("8601186017"); break;
case 286: printf("8613186137"); break;
case 287: printf("8614386161"); break;
case 288: printf("8710787119"); break;
case 289: printf("8718787211"); break;
case 290: printf("8905189057"); break;
case 291: printf("8911389119"); break;
case 292: printf("8944389449"); break;
case 293: printf("9043990469"); break;
case 294: printf("9054790583"); break;
case 295: printf("9067990697"); break;
case 296: printf("9084190847"); break;
case 297: printf("9091190917"); break;
case 298: printf("9180191807"); break;
case 299: printf("9187391909"); break;
case 300: printf("9264192647"); break;
case 301: printf("9271792723"); break;
case 302: printf("9292192927"); break;
case 303: printf("9337793383"); break;
case 304: printf("9342793463"); break;
case 305: printf("9352993553"); break;
case 306: printf("9360193607"); break;
case 307: printf("9513195143"); break;
case 308: printf("9526795273"); break;
case 309: printf("9544395461"); break;
case 310: printf("9600196013"); break;
case 311: printf("9637796401"); break;
case 312: printf("9655796581"); break;
case 313: printf("9695396959"); break;
case 314: printf("9725997283"); break;
case 315: printf("9793197943"); break;
case 316: printf("9877398779"); break;
case 317: printf("9898198993"); break;
case 318: printf("9934999367"); break;
case 319: printf("9976199767"); break;
case 320: printf("100043100049"); break;
case 321: printf("100703100733"); break;
case 322: printf("100811100823"); break;
case 323: printf("101341101347"); break;
case 324: printf("101477101483"); break;
case 325: printf("101873101879"); break;
case 326: printf("102149102161"); break;
case 327: printf("102587102593"); break;
case 328: printf("102983103001"); break;
case 329: printf("103511103529"); break;
case 330: printf("103613103619"); break;
case 331: printf("104207104231"); break;
case 332: printf("104417104459"); break;
case 333: printf("104723104729"); break;
case 334: printf("104947104953"); break;
case 335: printf("105031105037"); break;
case 336: printf("106123106129"); break;
case 337: printf("106243106261"); break;
case 338: printf("106307106319"); break;
case 339: printf("106373106391"); break;
case 340: printf("106531106537"); break;
case 341: printf("107021107033"); break;
case 342: printf("107641107647"); break;
case 343: printf("107981107999"); break;
case 344: printf("108089108107"); break;
case 345: printf("108517108529"); break;
case 346: printf("109891109897"); break;
case 347: printf("109943109961"); break;
case 348: printf("110441110459"); break;
case 349: printf("110927110933"); break;
case 350: printf("112019112031"); break;
case 351: printf("112061112067"); break;
case 352: printf("112261112279"); break;
case 353: printf("112831112843"); break;
case 354: printf("114013114031"); break;
case 355: printf("114547114553"); break;
case 356: printf("115727115733"); break;
case 357: printf("116101116107"); break;
case 358: printf("116141116159"); break;
case 359: printf("116747116789"); break;
case 360: printf("117659117671"); break;
case 361: printf("117991118033"); break;
case 362: printf("118621118633"); break;
case 363: printf("118891118897"); break;
case 364: printf("119191119227"); break;
case 365: printf("120181120193"); break;
case 366: printf("120623120641"); break;
case 367: printf("121351121357"); break;
case 368: printf("122971123001"); break;
case 369: printf("123493123499"); break;
case 370: printf("123619123631"); break;
case 371: printf("123887123911"); break;
case 372: printf("123983123989"); break;
case 373: printf("124291124297"); break;
case 374: printf("124529124541"); break;
case 375: printf("124543124561"); break;
case 376: printf("125063125093"); break;
case 377: printf("125527125539"); break;
case 378: printf("125753125777"); break;
case 379: printf("126199126211"); break;
case 380: printf("126751126757"); break;
case 381: printf("127703127709"); break;
case 382: printf("127763127781"); break;
case 383: printf("127819127837"); break;
case 384: printf("128341128347"); break;
case 385: printf("129737129749"); break;
case 386: printf("130057130069"); break;
case 387: printf("130643130649"); break;
case 388: printf("131507131519"); break;
case 389: printf("131743131749"); break;
case 390: printf("131849131861"); break;
case 391: printf("132257132263"); break;
case 392: printf("132541132547"); break;
case 393: printf("133321133327"); break;
case 394: printf("133451133481"); break;
case 395: printf("133657133669"); break;
case 396: printf("134741134753"); break;
case 397: printf("135271135277"); break;
case 398: printf("135449135461"); break;
case 399: printf("136261136273"); break;
case 400: printf("136373136379"); break;
case 401: printf("136483136501"); break;
case 402: printf("136999137029"); break;
case 403: printf("137119137131"); break;
case 404: printf("137353137359"); break;
case 405: printf("137363137369"); break;
case 406: printf("138059138071"); break;
case 407: printf("138739138763"); break;
case 408: printf("139133139169"); break;
case 409: printf("139837139861"); break;
case 410: printf("140557140587"); break;
case 411: printf("141551141587"); break;
case 412: printf("141833141851"); break;
case 413: printf("142537142543"); break;
case 414: printf("142973142979"); break;
case 415: printf("143357143387"); break;
case 416: printf("143419143443"); break;
case 417: printf("143477143483"); break;
case 418: printf("143779143791"); break;
case 419: printf("144593144611"); break;
case 420: printf("145213145219"); break;
case 421: printf("146173146191"); break;
case 422: printf("146477146513"); break;
case 423: printf("146701146719"); break;
case 424: printf("147151147163"); break;
case 425: printf("147179147197"); break;
case 426: printf("147481147487"); break;
case 427: printf("148249148279"); break;
case 428: printf("148381148387"); break;
case 429: printf("148793148817"); break;
case 430: printf("149893149899"); break;
case 431: printf("150197150203"); break;
case 432: printf("150517150523"); break;
case 433: printf("151051151057"); break;
case 434: printf("151433151451"); break;
case 435: printf("151597151603"); break;
case 436: printf("151787151799"); break;
case 437: printf("152519152531"); break;
case 438: printf("152909152939"); break;
case 439: printf("153457153469"); break;
case 440: printf("154823154841"); break;
case 441: printf("156707156719"); break;
case 442: printf("157679157721"); break;
case 443: printf("157733157739"); break;
case 444: printf("157901157907"); break;
case 445: printf("158329158341"); break;
case 446: printf("158791158803"); break;
case 447: printf("159023159059"); break;
case 448: printf("159073159079"); break;
case 449: printf("159473159491"); break;
case 450: printf("159541159553"); break;
case 451: printf("159773159779"); break;
case 452: printf("161033161039"); break;
case 453: printf("161047161053"); break;
case 454: printf("161971161977"); break;
case 455: printf("162017162053"); break;
case 456: printf("162119162143"); break;
case 457: printf("162209162221"); break;
case 458: printf("162451162457"); break;
case 459: printf("162671162677"); break;
case 460: printf("162823162829"); break;
case 461: printf("163243163249"); break;
case 462: printf("163259163307"); break;
case 463: printf("163627163633"); break;
case 464: printf("163847163853"); break;
case 465: printf("164267164279"); break;
case 466: printf("164309164321"); break;
case 467: printf("164963164987"); break;
case 468: printf("165161165173"); break;
case 469: printf("166247166259"); break;
case 470: printf("166357166363"); break;
case 471: printf("166931166949"); break;
case 472: printf("167261167267"); break;
case 473: printf("168937168943"); break;
case 474: printf("169321169327"); break;
case 475: printf("169483169489"); break;
case 476: printf("169633169639"); break;
case 477: printf("169859169889"); break;
case 478: printf("170341170347"); break;
case 479: printf("170551170557"); break;
case 480: printf("171673171679"); break;
case 481: printf("172993172999"); break;
case 482: printf("173933173969"); break;
case 483: printf("174653174659"); break;
case 484: printf("174703174721"); break;
case 485: printf("175361175391"); break;
case 486: printf("175853175859"); break;
case 487: printf("176237176243"); break;
case 488: printf("176611176629"); break;
case 489: printf("177211177217"); break;
case 490: printf("177257177269"); break;
case 491: printf("177791177797"); break;
case 492: printf("177811177823"); break;
case 493: printf("177943177949"); break;
case 494: printf("178489178501"); break;
case 495: printf("178819178831"); break;
case 496: printf("179651179657"); break;
case 497: printf("179693179717"); break;
case 498: printf("180247180259"); break;
case 499: printf("181669181693"); break;
case 500: printf("182537182549"); break;
}
putchar(10);
return 0;
}


var     n:longint;
const   a:array[1..500] of int64 =(23,
3137,
8389,
157163,
167173,
233239,
257263,
331337,
353359,
467479,
509521,
523541,
653659,
661673,
677683,
727733,
11871193,
12011213,
12591277,
13671373,
14531459,
16691693,
17091721,
17411747,
21792203,
22072213,
22812287,
23332339,
26212633,
26712677,
28972903,
29632969,
30673079,
32593271,
36373643,
37613767,
40994111,
43974409,
46034621,
46794691,
47334751,
47594783,
49194931,
55575563,
59275939,
63536359,
69776983,
73937411,
75837589,
78237829,
78837901,
79077919,
87618779,
90679091,
91879199,
92219227,
92939311,
96019613,
97699781,
98519857,
1086110867,
1139311399,
1171911731,
1254712553,
1272112739,
1303713043,
1361313619,
1424314249,
1474714753,
1519915217,
1524115259,
1537715383,
1560115607,
1574915761,
1576715773,
1641116417,
1669316699,
1674116747,
1678716811,
1693116937,
1729917317,
1753917551,
1795917971,
1832918341,
1843318439,
1871918731,
1901319031,
1921319219,
1928919301,
1957719583,
1986119867,
1991319919,
2071920731,
2116321169,
2140121407,
2191121929,
2205122063,
2217122189,
2275122769,
2287722901,
2380123813,
2385723869,
2404924061,
2407124077,
2409724103,
2415124169,
2425124281,
2511125117,
2512125127,
2517125183,
2544725453,
2545725463,
2566725673,
2584925867,
2617726183,
2632126339,
2639326399,
2650126513,
2653926557,
2672326729,
2678326801,
2729927329,
2750927527,
2831928349,
2880728813,
2892728933,
2933329339,
3051730529,
3088130893,
3101331019,
3105131063,
3165731663,
3179931817,
3234132353,
3247932491,
3260332609,
3283332839,
3291132917,
3350333521,
3360133613,
3362333629,
3459134603,
3468734693,
3496334981,
3526735279,
3559735603,
3596335969,
3699737003,
3736337369,
3751137517,
3765737663,
3925139293,
3930139313,
3955139563,
3986339869,
4017740189,
4028940343,
4045940471,
4059140597,
4060940627,
4073940751,
4099341011,
4122141227,
4204342061,
4233142337,
4245142457,
4246742473,
4273742743,
4354343573,
4402144027,
4402944041,
4450144507,
4475344771,
4508345119,
4543345439,
4555745569,
4582745833,
4615346171,
4752147527,
4756347569,
4801748023,
4887148883,
4922349253,
4952349529,
4987149877,
5017750207,
5022150227,
5042350441,
5077750789,
5125751263,
5148151487,
5185351859,
5230152313,
5296752973,
5371953731,
5377753783,
5413354139,
5443754443,
5466754673,
5479954829,
5584355849,
5609356099,
5626956299,
5668156687,
5704757059,
5773157737,
5780357809,
5856758573,
5922159233,
5956159567,
5995159957,
6001760029,
6147161483,
6172361729,
6242362459,
6336163367,
6337763389,
6346763473,
6352763533,
6362963647,
6401364019,
6428364301,
6479364811,
6512365129,
6541365419,
6555765563,
6599366029,
6654166553,
6665366683,
6728967307,
6742167427,
6744767453,
6796767979,
6809968111,
6817168207,
6843768443,
6896368993,
6903169061,
6959369623,
7006770079,
7048170487,
7134771353,
7184971861,
7230772313,
7268972701,
7290172907,
7330973327,
7352373529,
7354773553,
7369373699,
7370973721,
7382373847,
7396173973,
7402174027,
7407174077,
7409374099,
7435774363,
7445374471,
7450974521,
7474774759,
7521175217,
7532375329,
7552775533,
7598375989,
7625376259,
7828378301,
7869178697,
7975779769,
8016780173,
8031780329,
8042980447,
8065180657,
8098981001,
8134381349,
8214182153,
8340183407,
8343183437,
8401184017,
8413184137,
8482784857,
8510985121,
8551785523,
8560785619,
8579385817,
8601186017,
8613186137,
8614386161,
8710787119,
8718787211,
8905189057,
8911389119,
8944389449,
9043990469,
9054790583,
9067990697,
9084190847,
9091190917,
9180191807,
9187391909,
9264192647,
9271792723,
9292192927,
9337793383,
9342793463,
9352993553,
9360193607,
9513195143,
9526795273,
9544395461,
9600196013,
9637796401,
9655796581,
9695396959,
9725997283,
9793197943,
9877398779,
9898198993,
9934999367,
9976199767,
100043100049,
100703100733,
100811100823,
101341101347,
101477101483,
101873101879,
102149102161,
102587102593,
102983103001,
103511103529,
103613103619,
104207104231,
104417104459,
104723104729,
104947104953,
105031105037,
106123106129,
106243106261,
106307106319,
106373106391,
106531106537,
107021107033,
107641107647,
107981107999,
108089108107,
108517108529,
109891109897,
109943109961,
110441110459,
110927110933,
112019112031,
112061112067,
112261112279,
112831112843,
114013114031,
114547114553,
115727115733,
116101116107,
116141116159,
116747116789,
117659117671,
117991118033,
118621118633,
118891118897,
119191119227,
120181120193,
120623120641,
121351121357,
122971123001,
123493123499,
123619123631,
123887123911,
123983123989,
124291124297,
124529124541,
124543124561,
125063125093,
125527125539,
125753125777,
126199126211,
126751126757,
127703127709,
127763127781,
127819127837,
128341128347,
129737129749,
130057130069,
130643130649,
131507131519,
131743131749,
131849131861,
132257132263,
132541132547,
133321133327,
133451133481,
133657133669,
134741134753,
135271135277,
135449135461,
136261136273,
136373136379,
136483136501,
136999137029,
137119137131,
137353137359,
137363137369,
138059138071,
138739138763,
139133139169,
139837139861,
140557140587,
141551141587,
141833141851,
142537142543,
142973142979,
143357143387,
143419143443,
143477143483,
143779143791,
144593144611,
145213145219,
146173146191,
146477146513,
146701146719,
147151147163,
147179147197,
147481147487,
148249148279,
148381148387,
148793148817,
149893149899,
150197150203,
150517150523,
151051151057,
151433151451,
151597151603,
151787151799,
152519152531,
152909152939,
153457153469,
154823154841,
156707156719,
157679157721,
157733157739,
157901157907,
158329158341,
158791158803,
159023159059,
159073159079,
159473159491,
159541159553,
159773159779,
161033161039,
161047161053,
161971161977,
162017162053,
162119162143,
162209162221,
162451162457,
162671162677,
162823162829,
163243163249,
163259163307,
163627163633,
163847163853,
164267164279,
164309164321,
164963164987,
165161165173,
166247166259,
166357166363,
166931166949,
167261167267,
168937168943,
169321169327,
169483169489,
169633169639,
169859169889,
170341170347,
170551170557,
171673171679,
172993172999,
173933173969,
174653174659,
174703174721,
175361175391,
175853175859,
176237176243,
176611176629,
177211177217,
177257177269,
177791177797,
177811177823,
177943177949,
178489178501,
178819178831,
179651179657,
179693179717,
180247180259,
181669181693,
182537182549);
begin
write(a[n]);
end.


Code mẫu của RR

const a:array[1..500] of int64=
(23,3137,8389,157163,167173,233239,257263,331337,353359,467479,
509521,523541,653659,661673,677683,727733,11871193,12011213,12591277,13671373,
14531459,16691693,17091721,17411747,21792203,22072213,22812287,23332339,26212633,26712677,
28972903,29632969,30673079,32593271,36373643,37613767,40994111,43974409,46034621,46794691,
47334751,47594783,49194931,55575563,59275939,63536359,69776983,73937411,75837589,78237829,
78837901,79077919,87618779,90679091,91879199,92219227,92939311,96019613,97699781,98519857,
1086110867,1139311399,1171911731,1254712553,1272112739,1303713043,1361313619,1424314249,1474714753,1519915217,
1524115259,1537715383,1560115607,1574915761,1576715773,1641116417,1669316699,1674116747,1678716811,1693116937,
1729917317,1753917551,1795917971,1832918341,1843318439,1871918731,1901319031,1921319219,1928919301,1957719583,
1986119867,1991319919,2071920731,2116321169,2140121407,2191121929,2205122063,2217122189,2275122769,2287722901,
2380123813,2385723869,2404924061,2407124077,2409724103,2415124169,2425124281,2511125117,2512125127,2517125183,
2544725453,2545725463,2566725673,2584925867,2617726183,2632126339,2639326399,2650126513,2653926557,2672326729,
2678326801,2729927329,2750927527,2831928349,2880728813,2892728933,2933329339,3051730529,3088130893,3101331019,
3105131063,3165731663,3179931817,3234132353,3247932491,3260332609,3283332839,3291132917,3350333521,3360133613,
3362333629,3459134603,3468734693,3496334981,3526735279,3559735603,3596335969,3699737003,3736337369,3751137517,
3765737663,3925139293,3930139313,3955139563,3986339869,4017740189,4028940343,4045940471,4059140597,4060940627,
4073940751,4099341011,4122141227,4204342061,4233142337,4245142457,4246742473,4273742743,4354343573,4402144027,
4402944041,4450144507,4475344771,4508345119,4543345439,4555745569,4582745833,4615346171,4752147527,4756347569,
4801748023,4887148883,4922349253,4952349529,4987149877,5017750207,5022150227,5042350441,5077750789,5125751263,
5148151487,5185351859,5230152313,5296752973,5371953731,5377753783,5413354139,5443754443,5466754673,5479954829,
5584355849,5609356099,5626956299,5668156687,5704757059,5773157737,5780357809,5856758573,5922159233,5956159567,
5995159957,6001760029,6147161483,6172361729,6242362459,6336163367,6337763389,6346763473,6352763533,6362963647,
6401364019,6428364301,6479364811,6512365129,6541365419,6555765563,6599366029,6654166553,6665366683,6728967307,
6742167427,6744767453,6796767979,6809968111,6817168207,6843768443,6896368993,6903169061,6959369623,7006770079,
7048170487,7134771353,7184971861,7230772313,7268972701,7290172907,7330973327,7352373529,7354773553,7369373699,
7370973721,7382373847,7396173973,7402174027,7407174077,7409374099,7435774363,7445374471,7450974521,7474774759,
7521175217,7532375329,7552775533,7598375989,7625376259,7828378301,7869178697,7975779769,8016780173,8031780329,
8042980447,8065180657,8098981001,8134381349,8214182153,8340183407,8343183437,8401184017,8413184137,8482784857,
8510985121,8551785523,8560785619,8579385817,8601186017,8613186137,8614386161,8710787119,8718787211,8905189057,
8911389119,8944389449,9043990469,9054790583,9067990697,9084190847,9091190917,9180191807,9187391909,9264192647,
9271792723,9292192927,9337793383,9342793463,9352993553,9360193607,9513195143,9526795273,9544395461,9600196013,
9637796401,9655796581,9695396959,9725997283,9793197943,9877398779,9898198993,9934999367,9976199767,100043100049,
100703100733,100811100823,101341101347,101477101483,101873101879,102149102161,102587102593,102983103001,103511103529,103613103619,
104207104231,104417104459,104723104729,104947104953,105031105037,106123106129,106243106261,106307106319,106373106391,106531106537,
107021107033,107641107647,107981107999,108089108107,108517108529,109891109897,109943109961,110441110459,110927110933,112019112031,
112061112067,112261112279,112831112843,114013114031,114547114553,115727115733,116101116107,116141116159,116747116789,117659117671,
117991118033,118621118633,118891118897,119191119227,120181120193,120623120641,121351121357,122971123001,123493123499,123619123631,
123887123911,123983123989,124291124297,124529124541,124543124561,125063125093,125527125539,125753125777,126199126211,126751126757,
127703127709,127763127781,127819127837,128341128347,129737129749,130057130069,130643130649,131507131519,131743131749,131849131861,
132257132263,132541132547,133321133327,133451133481,133657133669,134741134753,135271135277,135449135461,136261136273,136373136379,
136483136501,136999137029,137119137131,137353137359,137363137369,138059138071,138739138763,139133139169,139837139861,140557140587,
141551141587,141833141851,142537142543,142973142979,143357143387,143419143443,143477143483,143779143791,144593144611,145213145219,
146173146191,146477146513,146701146719,147151147163,147179147197,147481147487,148249148279,148381148387,148793148817,149893149899,
150197150203,150517150523,151051151057,151433151451,151597151603,151787151799,152519152531,152909152939,153457153469,154823154841,
156707156719,157679157721,157733157739,157901157907,158329158341,158791158803,159023159059,159073159079,159473159491,159541159553,
159773159779,161033161039,161047161053,161971161977,162017162053,162119162143,162209162221,162451162457,162671162677,162823162829,
163243163249,163259163307,163627163633,163847163853,164267164279,164309164321,164963164987,165161165173,166247166259,166357166363,
166931166949,167261167267,168937168943,169321169327,169483169489,169633169639,169859169889,170341170347,170551170557,171673171679,
172993172999,173933173969,174653174659,174703174721,175361175391,175853175859,176237176243,176611176629,177211177217,177257177269,
177791177797,177811177823,177943177949,178489178501,178819178831,179651179657,179693179717,180247180259,181669181693,182537182549);

var
n:longint;

begin
writeln(a[n]);
end.


Code mẫu của hieult

#include <cstdio>
//#include <conio.h>
#include <iostream>
#include <cstring>

using namespace std;

string P[1000];

int main()
{
int n;
P[1]="23";
P[2]="3137";
P[3]="8389";
P[4]="157163";
P[5]="167173";
P[6]="233239";
P[7]="257263";
P[8]="331337";
P[9]="353359";
P[10]="467479";
P[11]="509521";
P[12]="523541";
P[13]="653659";
P[14]="661673";
P[15]="677683";
P[16]="727733";
P[17]="11871193";
P[18]="12011213";
P[19]="12591277";
P[20]="13671373";
P[21]="14531459";
P[22]="16691693";
P[23]="17091721";
P[24]="17411747";
P[25]="21792203";
P[26]="22072213";
P[27]="22812287";
P[28]="23332339";
P[29]="26212633";
P[30]="26712677";
P[31]="28972903";
P[32]="29632969";
P[33]="30673079";
P[34]="32593271";
P[35]="36373643";
P[36]="37613767";
P[37]="40994111";
P[38]="43974409";
P[39]="46034621";
P[40]="46794691";
P[41]="47334751";
P[42]="47594783";
P[43]="49194931";
P[44]="55575563";
P[45]="59275939";
P[46]="63536359";
P[47]="69776983";
P[48]="73937411";
P[49]="75837589";
P[50]="78237829";
P[51]="78837901";
P[52]="79077919";
P[53]="87618779";
P[54]="90679091";
P[55]="91879199";
P[56]="92219227";
P[57]="92939311";
P[58]="96019613";
P[59]="97699781";
P[60]="98519857";
P[61]="1086110867";
P[62]="1139311399";
P[63]="1171911731";
P[64]="1254712553";
P[65]="1272112739";
P[66]="1303713043";
P[67]="1361313619";
P[68]="1424314249";
P[69]="1474714753";
P[70]="1519915217";
P[71]="1524115259";
P[72]="1537715383";
P[73]="1560115607";
P[74]="1574915761";
P[75]="1576715773";
P[76]="1641116417";
P[77]="1669316699";
P[78]="1674116747";
P[79]="1678716811";
P[80]="1693116937";
P[81]="1729917317";
P[82]="1753917551";
P[83]="1795917971";
P[84]="1832918341";
P[85]="1843318439";
P[86]="1871918731";
P[87]="1901319031";
P[88]="1921319219";
P[89]="1928919301";
P[90]="1957719583";
P[91]="1986119867";
P[92]="1991319919";
P[93]="2071920731";
P[94]="2116321169";
P[95]="2140121407";
P[96]="2191121929";
P[97]="2205122063";
P[98]="2217122189";
P[99]="2275122769";
P[100]="2287722901";
P[101]="2380123813";
P[102]="2385723869";
P[103]="2404924061";
P[104]="2407124077";
P[105]="2409724103";
P[106]="2415124169";
P[107]="2425124281";
P[108]="2511125117";
P[109]="2512125127";
P[110]="2517125183";
P[111]="2544725453";
P[112]="2545725463";
P[113]="2566725673";
P[114]="2584925867";
P[115]="2617726183";
P[116]="2632126339";
P[117]="2639326399";
P[118]="2650126513";
P[119]="2653926557";
P[120]="2672326729";
P[121]="2678326801";
P[122]="2729927329";
P[123]="2750927527";
P[124]="2831928349";
P[125]="2880728813";
P[126]="2892728933";
P[127]="2933329339";
P[128]="3051730529";
P[129]="3088130893";
P[130]="3101331019";
P[131]="3105131063";
P[132]="3165731663";
P[133]="3179931817";
P[134]="3234132353";
P[135]="3247932491";
P[136]="3260332609";
P[137]="3283332839";
P[138]="3291132917";
P[139]="3350333521";
P[140]="3360133613";
P[141]="3362333629";
P[142]="3459134603";
P[143]="3468734693";
P[144]="3496334981";
P[145]="3526735279";
P[146]="3559735603";
P[147]="3596335969";
P[148]="3699737003";
P[149]="3736337369";
P[150]="3751137517";
P[151]="3765737663";
P[152]="3925139293";
P[153]="3930139313";
P[154]="3955139563";
P[155]="3986339869";
P[156]="4017740189";
P[157]="4028940343";
P[158]="4045940471";
P[159]="4059140597";
P[160]="4060940627";
P[161]="4073940751";
P[162]="4099341011";
P[163]="4122141227";
P[164]="4204342061";
P[165]="4233142337";
P[166]="4245142457";
P[167]="4246742473";
P[168]="4273742743";
P[169]="4354343573";
P[170]="4402144027";
P[171]="4402944041";
P[172]="4450144507";
P[173]="4475344771";
P[174]="4508345119";
P[175]="4543345439";
P[176]="4555745569";
P[177]="4582745833";
P[178]="4615346171";
P[179]="4752147527";
P[180]="4756347569";
P[181]="4801748023";
P[182]="4887148883";
P[183]="4922349253";
P[184]="4952349529";
P[185]="4987149877";
P[186]="5017750207";
P[187]="5022150227";
P[188]="5042350441";
P[189]="5077750789";
P[190]="5125751263";
P[191]="5148151487";
P[192]="5185351859";
P[193]="5230152313";
P[194]="5296752973";
P[195]="5371953731";
P[196]="5377753783";
P[197]="5413354139";
P[198]="5443754443";
P[199]="5466754673";
P[200]="5479954829";
P[201]="5584355849";
P[202]="5609356099";
P[203]="5626956299";
P[204]="5668156687";
P[205]="5704757059";
P[206]="5773157737";
P[207]="5780357809";
P[208]="5856758573";
P[209]="5922159233";
P[210]="5956159567";
P[211]="5995159957";
P[212]="6001760029";
P[213]="6147161483";
P[214]="6172361729";
P[215]="6242362459";
P[216]="6336163367";
P[217]="6337763389";
P[218]="6346763473";
P[219]="6352763533";
P[220]="6362963647";
P[221]="6401364019";
P[222]="6428364301";
P[223]="6479364811";
P[224]="6512365129";
P[225]="6541365419";
P[226]="6555765563";
P[227]="6599366029";
P[228]="6654166553";
P[229]="6665366683";
P[230]="6728967307";
P[231]="6742167427";
P[232]="6744767453";
P[233]="6796767979";
P[234]="6809968111";
P[235]="6817168207";
P[236]="6843768443";
P[237]="6896368993";
P[238]="6903169061";
P[239]="6959369623";
P[240]="7006770079";
P[241]="7048170487";
P[242]="7134771353";
P[243]="7184971861";
P[244]="7230772313";
P[245]="7268972701";
P[246]="7290172907";
P[247]="7330973327";
P[248]="7352373529";
P[249]="7354773553";
P[250]="7369373699";
P[251]="7370973721";
P[252]="7382373847";
P[253]="7396173973";
P[254]="7402174027";
P[255]="7407174077";
P[256]="7409374099";
P[257]="7435774363";
P[258]="7445374471";
P[259]="7450974521";
P[260]="7474774759";
P[261]="7521175217";
P[262]="7532375329";
P[263]="7552775533";
P[264]="7598375989";
P[265]="7625376259";
P[266]="7828378301";
P[267]="7869178697";
P[268]="7975779769";
P[269]="8016780173";
P[270]="8031780329";
P[271]="8042980447";
P[272]="8065180657";
P[273]="8098981001";
P[274]="8134381349";
P[275]="8214182153";
P[276]="8340183407";
P[277]="8343183437";
P[278]="8401184017";
P[279]="8413184137";
P[280]="8482784857";
P[281]="8510985121";
P[282]="8551785523";
P[283]="8560785619";
P[284]="8579385817";
P[285]="8601186017";
P[286]="8613186137";
P[287]="8614386161";
P[288]="8710787119";
P[289]="8718787211";
P[290]="8905189057";
P[291]="8911389119";
P[292]="8944389449";
P[293]="9043990469";
P[294]="9054790583";
P[295]="9067990697";
P[296]="9084190847";
P[297]="9091190917";
P[298]="9180191807";
P[299]="9187391909";
P[300]="9264192647";
P[301]="9271792723";
P[302]="9292192927";
P[303]="9337793383";
P[304]="9342793463";
P[305]="9352993553";
P[306]="9360193607";
P[307]="9513195143";
P[308]="9526795273";
P[309]="9544395461";
P[310]="9600196013";
P[311]="9637796401";
P[312]="9655796581";
P[313]="9695396959";
P[314]="9725997283";
P[315]="9793197943";
P[316]="9877398779";
P[317]="9898198993";
P[318]="9934999367";
P[319]="9976199767";
P[320]="100043100049";
P[321]="100703100733";
P[322]="100811100823";
P[323]="101341101347";
P[324]="101477101483";
P[325]="101873101879";
P[326]="102149102161";
P[327]="102587102593";
P[328]="102983103001";
P[329]="103511103529";
P[330]="103613103619";
P[331]="104207104231";
P[332]="104417104459";
P[333]="104723104729";
P[334]="104947104953";
P[335]="105031105037";
P[336]="106123106129";
P[337]="106243106261";
P[338]="106307106319";
P[339]="106373106391";
P[340]="106531106537";
P[341]="107021107033";
P[342]="107641107647";
P[343]="107981107999";
P[344]="108089108107";
P[345]="108517108529";
P[346]="109891109897";
P[347]="109943109961";
P[348]="110441110459";
P[349]="110927110933";
P[350]="112019112031";
P[351]="112061112067";
P[352]="112261112279";
P[353]="112831112843";
P[354]="114013114031";
P[355]="114547114553";
P[356]="115727115733";
P[357]="116101116107";
P[358]="116141116159";
P[359]="116747116789";
P[360]="117659117671";
P[361]="117991118033";
P[362]="118621118633";
P[363]="118891118897";
P[364]="119191119227";
P[365]="120181120193";
P[366]="120623120641";
P[367]="121351121357";
P[368]="122971123001";
P[369]="123493123499";
P[370]="123619123631";
P[371]="123887123911";
P[372]="123983123989";
P[373]="124291124297";
P[374]="124529124541";
P[375]="124543124561";
P[376]="125063125093";
P[377]="125527125539";
P[378]="125753125777";
P[379]="126199126211";
P[380]="126751126757";
P[381]="127703127709";
P[382]="127763127781";
P[383]="127819127837";
P[384]="128341128347";
P[385]="129737129749";
P[386]="130057130069";
P[387]="130643130649";
P[388]="131507131519";
P[389]="131743131749";
P[390]="131849131861";
P[391]="132257132263";
P[392]="132541132547";
P[393]="133321133327";
P[394]="133451133481";
P[395]="133657133669";
P[396]="134741134753";
P[397]="135271135277";
P[398]="135449135461";
P[399]="136261136273";
P[400]="136373136379";
P[401]="136483136501";
P[402]="136999137029";
P[403]="137119137131";
P[404]="137353137359";
P[405]="137363137369";
P[406]="138059138071";
P[407]="138739138763";
P[408]="139133139169";
P[409]="139837139861";
P[410]="140557140587";
P[411]="141551141587";
P[412]="141833141851";
P[413]="142537142543";
P[414]="142973142979";
P[415]="143357143387";
P[416]="143419143443";
P[417]="143477143483";
P[418]="143779143791";
P[419]="144593144611";
P[420]="145213145219";
P[421]="146173146191";
P[422]="146477146513";
P[423]="146701146719";
P[424]="147151147163";
P[425]="147179147197";
P[426]="147481147487";
P[427]="148249148279";
P[428]="148381148387";
P[429]="148793148817";
P[430]="149893149899";
P[431]="150197150203";
P[432]="150517150523";
P[433]="151051151057";
P[434]="151433151451";
P[435]="151597151603";
P[436]="151787151799";
P[437]="152519152531";
P[438]="152909152939";
P[439]="153457153469";
P[440]="154823154841";
P[441]="156707156719";
P[442]="157679157721";
P[443]="157733157739";
P[444]="157901157907";
P[445]="158329158341";
P[446]="158791158803";
P[447]="159023159059";
P[448]="159073159079";
P[449]="159473159491";
P[450]="159541159553";
P[451]="159773159779";
P[452]="161033161039";
P[453]="161047161053";
P[454]="161971161977";
P[455]="162017162053";
P[456]="162119162143";
P[457]="162209162221";
P[458]="162451162457";
P[459]="162671162677";
P[460]="162823162829";
P[461]="163243163249";
P[462]="163259163307";
P[463]="163627163633";
P[464]="163847163853";
P[465]="164267164279";
P[466]="164309164321";
P[467]="164963164987";
P[468]="165161165173";
P[469]="166247166259";
P[470]="166357166363";
P[471]="166931166949";
P[472]="167261167267";
P[473]="168937168943";
P[474]="169321169327";
P[475]="169483169489";
P[476]="169633169639";
P[477]="169859169889";
P[478]="170341170347";
P[479]="170551170557";
P[480]="171673171679";
P[481]="172993172999";
P[482]="173933173969";
P[483]="174653174659";
P[484]="174703174721";
P[485]="175361175391";
P[486]="175853175859";
P[487]="176237176243";
P[488]="176611176629";
P[489]="177211177217";
P[490]="177257177269";
P[491]="177791177797";
P[492]="177811177823";
P[493]="177943177949";
P[494]="178489178501";
P[495]="178819178831";
P[496]="179651179657";
P[497]="179693179717";
P[498]="180247180259";
P[499]="181669181693";
P[500]="182537182549";
scanf("%d",&n);cout<<P[n];
}


Code mẫu của ll931110

program mprime;
const
maxk = 500;
a: array[1..maxk] of qword =
(23,3137,8389,157163,167173,233239,257263,
331337,353359,467479,509521,523541,653659,661673,677683,
727733,11871193,12011213,12591277,13671373,14531459,16691693,17091721,
17411747,21792203,22072213,22812287,23332339,26212633,26712677,28972903,
29632969,30673079,32593271,36373643,37613767,40994111,43974409,46034621,
46794691,47334751,47594783,49194931,55575563,59275939,63536359,69776983,
73937411,75837589,78237829,78837901,79077919,87618779,90679091,91879199,
92219227,92939311,96019613,97699781,98519857,1086110867,1139311399,1171911731,
1254712553,1272112739,1303713043,1361313619,1424314249,1474714753,1519915217,1524115259,
1537715383,1560115607,1574915761,1576715773,1641116417,1669316699,1674116747,1678716811,
1693116937,1729917317,1753917551,1795917971,1832918341,1843318439,1871918731,1901319031,
1921319219,1928919301,1957719583,1986119867,1991319919,2071920731,2116321169,2140121407,
2191121929,2205122063,2217122189,2275122769,2287722901,2380123813,2385723869,2404924061,
2407124077,2409724103,2415124169,2425124281,2511125117,2512125127,2517125183,2544725453,
2545725463,2566725673,2584925867,2617726183,2632126339,2639326399,2650126513,2653926557,
2672326729,2678326801,2729927329,2750927527,2831928349,2880728813,2892728933,2933329339,
3051730529,3088130893,3101331019,3105131063,3165731663,3179931817,3234132353,3247932491,
3260332609,3283332839,3291132917,3350333521,3360133613,3362333629,3459134603,3468734693,
3496334981,3526735279,3559735603,3596335969,3699737003,3736337369,3751137517,3765737663,
3925139293,3930139313,3955139563,3986339869,4017740189,4028940343,4045940471,4059140597,
4060940627,4073940751,4099341011,4122141227,4204342061,4233142337,4245142457,4246742473,
4273742743,4354343573,4402144027,4402944041,4450144507,4475344771,4508345119,4543345439,
4555745569,4582745833,4615346171,4752147527,4756347569,4801748023,4887148883,4922349253,
4952349529,4987149877,5017750207,5022150227,5042350441,5077750789,5125751263,5148151487,
5185351859,5230152313,5296752973,5371953731,5377753783,5413354139,5443754443,5466754673,
5479954829,5584355849,5609356099,5626956299,5668156687,5704757059,5773157737,5780357809,
5856758573,5922159233,5956159567,5995159957,6001760029,6147161483,6172361729,6242362459,
6336163367,6337763389,6346763473,6352763533,6362963647,6401364019,6428364301,6479364811,
6512365129,6541365419,6555765563,6599366029,6654166553,6665366683,6728967307,6742167427,
6744767453,6796767979,6809968111,6817168207,6843768443,6896368993,6903169061,6959369623,
7006770079,7048170487,7134771353,7184971861,7230772313,7268972701,7290172907,7330973327,
7352373529,7354773553,7369373699,7370973721,7382373847,7396173973,7402174027,7407174077,
7409374099,7435774363,7445374471,7450974521,7474774759,7521175217,7532375329,7552775533,
7598375989,7625376259,7828378301,7869178697,7975779769,8016780173,8031780329,8042980447,
8065180657,8098981001,8134381349,8214182153,8340183407,8343183437,8401184017,8413184137,
8482784857,8510985121,8551785523,8560785619,8579385817,8601186017,8613186137,8614386161,
8710787119,8718787211,8905189057,8911389119,8944389449,9043990469,9054790583,9067990697,
9084190847,9091190917,9180191807,9187391909,9264192647,9271792723,9292192927,9337793383,
9342793463,9352993553,9360193607,9513195143,9526795273,9544395461,9600196013,9637796401,
9655796581,9695396959,9725997283,9793197943,9877398779,9898198993,9934999367,9976199767,
100043100049,100703100733,100811100823,101341101347,101477101483,101873101879,102149102161,102587102593,
102983103001,103511103529,103613103619,104207104231,104417104459,104723104729,104947104953,105031105037,
106123106129,106243106261,106307106319,106373106391,106531106537,107021107033,107641107647,107981107999,
108089108107,108517108529,109891109897,109943109961,110441110459,110927110933,112019112031,112061112067,
112261112279,112831112843,114013114031,114547114553,115727115733,116101116107,116141116159,116747116789,
117659117671,117991118033,118621118633,118891118897,119191119227,120181120193,120623120641,121351121357,
122971123001,123493123499,123619123631,123887123911,123983123989,124291124297,124529124541,124543124561,
125063125093,125527125539,125753125777,126199126211,126751126757,127703127709,127763127781,127819127837,
128341128347,129737129749,130057130069,130643130649,131507131519,131743131749,131849131861,132257132263,
132541132547,133321133327,133451133481,133657133669,134741134753,135271135277,135449135461,136261136273,
136373136379,136483136501,136999137029,137119137131,137353137359,137363137369,138059138071,138739138763,
139133139169,139837139861,140557140587,141551141587,141833141851,142537142543,142973142979,143357143387,
143419143443,143477143483,143779143791,144593144611,145213145219,146173146191,146477146513,146701146719,
147151147163,147179147197,147481147487,148249148279,148381148387,148793148817,149893149899,150197150203,
150517150523,151051151057,151433151451,151597151603,151787151799,152519152531,152909152939,153457153469,
154823154841,156707156719,157679157721,157733157739,157901157907,158329158341,158791158803,159023159059,
159073159079,159473159491,159541159553,159773159779,161033161039,161047161053,161971161977,162017162053,
162119162143,162209162221,162451162457,162671162677,162823162829,163243163249,163259163307,163627163633,
163847163853,164267164279,164309164321,164963164987,165161165173,166247166259,166357166363,166931166949,
167261167267,168937168943,169321169327,169483169489,169633169639,169859169889,170341170347,170551170557,
171673171679,172993172999,173933173969,174653174659,174703174721,175361175391,175853175859,176237176243,
176611176629,177211177217,177257177269,177791177797,177811177823,177943177949,178489178501,178819178831,
179651179657,179693179717,180247180259,181669181693,182537182549);

var
k: integer;

begin
writeln(a[k]);
end.


Code mẫu của skyvn97

#include<stdio.h>
char res[][100]={"0","23","3137","8389","157163","167173","233239","257263","331337","353359","467479","509521","523541","653659","661673","677683","727733","11871193","12011213","12591277","13671373","14531459","16691693","17091721","17411747","21792203","22072213","22812287","23332339","26212633","26712677","28972903","29632969","30673079","32593271","36373643","37613767","40994111","43974409","46034621","46794691","47334751","47594783","49194931","55575563","59275939","63536359","69776983","73937411","75837589","78237829","78837901","79077919","87618779","90679091","91879199","92219227","92939311","96019613","97699781","98519857","1086110867","1139311399","1171911731","1254712553","1272112739","1303713043","1361313619","1424314249","1474714753","1519915217","1524115259","1537715383","1560115607","1574915761","1576715773","1641116417","1669316699","1674116747","1678716811","1693116937","1729917317","1753917551","1795917971","1832918341","1843318439","1871918731","1901319031","1921319219","1928919301","1957719583","1986119867","1991319919","2071920731","2116321169","2140121407","2191121929","2205122063","2217122189","2275122769","2287722901","2380123813","2385723869","2404924061","2407124077","2409724103","2415124169","2425124281","2511125117","2512125127","2517125183","2544725453","2545725463","2566725673","2584925867","2617726183","2632126339","2639326399","2650126513","2653926557","2672326729","2678326801","2729927329","2750927527","2831928349","2880728813","2892728933","2933329339","3051730529","3088130893","3101331019","3105131063","3165731663","3179931817","3234132353","3247932491","3260332609","3283332839","3291132917","3350333521","3360133613","3362333629","3459134603","3468734693","3496334981","3526735279","3559735603","3596335969","3699737003","3736337369","3751137517","3765737663","3925139293","3930139313","3955139563","3986339869","4017740189","4028940343","4045940471","4059140597","4060940627","4073940751","4099341011","4122141227","4204342061","4233142337","4245142457","4246742473","4273742743","4354343573","4402144027","4402944041","4450144507","4475344771","4508345119","4543345439","4555745569","4582745833","4615346171","4752147527","4756347569","4801748023","4887148883","4922349253","4952349529","4987149877","5017750207","5022150227","5042350441","5077750789","5125751263","5148151487","5185351859","5230152313","5296752973","5371953731","5377753783","5413354139","5443754443","5466754673","5479954829","5584355849","5609356099","5626956299","5668156687","5704757059","5773157737","5780357809","5856758573","5922159233","5956159567","5995159957","6001760029","6147161483","6172361729","6242362459","6336163367","6337763389","6346763473","6352763533","6362963647","6401364019","6428364301","6479364811","6512365129","6541365419","6555765563","6599366029","6654166553","6665366683","6728967307","6742167427","6744767453","6796767979","6809968111","6817168207","6843768443","6896368993","6903169061","6959369623","7006770079","7048170487","7134771353","7184971861","7230772313","7268972701","7290172907","7330973327","7352373529","7354773553","7369373699","7370973721","7382373847","7396173973","7402174027","7407174077","7409374099","7435774363","7445374471","7450974521","7474774759","7521175217","7532375329","7552775533","7598375989","7625376259","7828378301","7869178697","7975779769","8016780173","8031780329","8042980447","8065180657","8098981001","8134381349","8214182153","8340183407","8343183437","8401184017","8413184137","8482784857","8510985121","8551785523","8560785619","8579385817","8601186017","8613186137","8614386161","8710787119","8718787211","8905189057","8911389119","8944389449","9043990469","9054790583","9067990697","9084190847","9091190917","9180191807","9187391909","9264192647","9271792723","9292192927","9337793383","9342793463","9352993553","9360193607","9513195143","9526795273","9544395461","9600196013","9637796401","9655796581","9695396959","9725997283","9793197943","9877398779","9898198993","9934999367","9976199767","100043100049","100703100733","100811100823","101341101347","101477101483","101873101879","102149102161","102587102593","102983103001","103511103529","103613103619","104207104231","104417104459","104723104729","104947104953","105031105037","106123106129","106243106261","106307106319","106373106391","106531106537","107021107033","107641107647","107981107999","108089108107","108517108529","109891109897","109943109961","110441110459","110927110933","112019112031","112061112067","112261112279","112831112843","114013114031","114547114553","115727115733","116101116107","116141116159","116747116789","117659117671","117991118033","118621118633","118891118897","119191119227","120181120193","120623120641","121351121357","122971123001","123493123499","123619123631","123887123911","123983123989","124291124297","124529124541","124543124561","125063125093","125527125539","125753125777","126199126211","126751126757","127703127709","127763127781","127819127837","128341128347","129737129749","130057130069","130643130649","131507131519","131743131749","131849131861","132257132263","132541132547","133321133327","133451133481","133657133669","134741134753","135271135277","135449135461","136261136273","136373136379","136483136501","136999137029","137119137131","137353137359","137363137369","138059138071","138739138763","139133139169","139837139861","140557140587","141551141587","141833141851","142537142543","142973142979","143357143387","143419143443","143477143483","143779143791","144593144611","145213145219","146173146191","146477146513","146701146719","147151147163","147179147197","147481147487","148249148279","148381148387","148793148817","149893149899","150197150203","150517150523","151051151057","151433151451","151597151603","151787151799","152519152531","152909152939","153457153469","154823154841","156707156719","157679157721","157733157739","157901157907","158329158341","158791158803","159023159059","159073159079","159473159491","159541159553","159773159779","161033161039","161047161053","161971161977","162017162053","162119162143","162209162221","162451162457","162671162677","162823162829","163243163249","163259163307","163627163633","163847163853","164267164279","164309164321","164963164987","165161165173","166247166259","166357166363","166931166949","167261167267","168937168943","169321169327","169483169489","169633169639","169859169889","170341170347","170551170557","171673171679","172993172999","173933173969","174653174659","174703174721","175361175391","175853175859","176237176243","176611176629","177211177217","177257177269","177791177797","177811177823","177943177949","178489178501","178819178831","179651179657","179693179717","180247180259","181669181693","182537182549"};
int n;
int main(void)
{
scanf("%d",&n);
printf("%s",res[n]);
}


Code mẫu của khuc_tuan

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
long[] r = new long[] { 23L, 3137L, 8389L, 157163L, 167173L, 233239L,
257263L, 331337L, 353359L, 467479L, 509521L, 523541L, 653659L,
661673L, 677683L, 727733L, 11871193L, 12011213L, 12591277L,
13671373L, 14531459L, 16691693L, 17091721L, 17411747L,
21792203L, 22072213L, 22812287L, 23332339L, 26212633L,
26712677L, 28972903L, 29632969L, 30673079L, 32593271L,
36373643L, 37613767L, 40994111L, 43974409L, 46034621L,
46794691L, 47334751L, 47594783L, 49194931L, 55575563L,
59275939L, 63536359L, 69776983L, 73937411L, 75837589L,
78237829L, 78837901L, 79077919L, 87618779L, 90679091L,
91879199L, 92219227L, 92939311L, 96019613L, 97699781L,
98519857L, 1086110867L, 1139311399L, 1171911731L, 1254712553L,
1272112739L, 1303713043L, 1361313619L, 1424314249L,
1474714753L, 1519915217L, 1524115259L, 1537715383L,
1560115607L, 1574915761L, 1576715773L, 1641116417L,
1669316699L, 1674116747L, 1678716811L, 1693116937L,
1729917317L, 1753917551L, 1795917971L, 1832918341L,
1843318439L, 1871918731L, 1901319031L, 1921319219L,
1928919301L, 1957719583L, 1986119867L, 1991319919L,
2071920731L, 2116321169L, 2140121407L, 2191121929L,
2205122063L, 2217122189L, 2275122769L, 2287722901L,
2380123813L, 2385723869L, 2404924061L, 2407124077L,
2409724103L, 2415124169L, 2425124281L, 2511125117L,
2512125127L, 2517125183L, 2544725453L, 2545725463L,
2566725673L, 2584925867L, 2617726183L, 2632126339L,
2639326399L, 2650126513L, 2653926557L, 2672326729L,
2678326801L, 2729927329L, 2750927527L, 2831928349L,
2880728813L, 2892728933L, 2933329339L, 3051730529L,
3088130893L, 3101331019L, 3105131063L, 3165731663L,
3179931817L, 3234132353L, 3247932491L, 3260332609L,
3283332839L, 3291132917L, 3350333521L, 3360133613L,
3362333629L, 3459134603L, 3468734693L, 3496334981L,
3526735279L, 3559735603L, 3596335969L, 3699737003L,
3736337369L, 3751137517L, 3765737663L, 3925139293L,
3930139313L, 3955139563L, 3986339869L, 4017740189L,
4028940343L, 4045940471L, 4059140597L, 4060940627L,
4073940751L, 4099341011L, 4122141227L, 4204342061L,
4233142337L, 4245142457L, 4246742473L, 4273742743L,
4354343573L, 4402144027L, 4402944041L, 4450144507L,
4475344771L, 4508345119L, 4543345439L, 4555745569L,
4582745833L, 4615346171L, 4752147527L, 4756347569L,
4801748023L, 4887148883L, 4922349253L, 4952349529L,
4987149877L, 5017750207L, 5022150227L, 5042350441L,
5077750789L, 5125751263L, 5148151487L, 5185351859L,
5230152313L, 5296752973L, 5371953731L, 5377753783L,
5413354139L, 5443754443L, 5466754673L, 5479954829L,
5584355849L, 5609356099L, 5626956299L, 5668156687L,
5704757059L, 5773157737L, 5780357809L, 5856758573L,
5922159233L, 5956159567L, 5995159957L, 6001760029L,
6147161483L, 6172361729L, 6242362459L, 6336163367L,
6337763389L, 6346763473L, 6352763533L, 6362963647L,
6401364019L, 6428364301L, 6479364811L, 6512365129L,
6541365419L, 6555765563L, 6599366029L, 6654166553L,
6665366683L, 6728967307L, 6742167427L, 6744767453L,
6796767979L, 6809968111L, 6817168207L, 6843768443L,
6896368993L, 6903169061L, 6959369623L, 7006770079L,
7048170487L, 7134771353L, 7184971861L, 7230772313L,
7268972701L, 7290172907L, 7330973327L, 7352373529L,
7354773553L, 7369373699L, 7370973721L, 7382373847L,
7396173973L, 7402174027L, 7407174077L, 7409374099L,
7435774363L, 7445374471L, 7450974521L, 7474774759L,
7521175217L, 7532375329L, 7552775533L, 7598375989L,
7625376259L, 7828378301L, 7869178697L, 7975779769L,
8016780173L, 8031780329L, 8042980447L, 8065180657L,
8098981001L, 8134381349L, 8214182153L, 8340183407L,
8343183437L, 8401184017L, 8413184137L, 8482784857L,
8510985121L, 8551785523L, 8560785619L, 8579385817L,
8601186017L, 8613186137L, 8614386161L, 8710787119L,
8718787211L, 8905189057L, 8911389119L, 8944389449L,
9043990469L, 9054790583L, 9067990697L, 9084190847L,
9091190917L, 9180191807L, 9187391909L, 9264192647L,
9271792723L, 9292192927L, 9337793383L, 9342793463L,
9352993553L, 9360193607L, 9513195143L, 9526795273L,
9544395461L, 9600196013L, 9637796401L, 9655796581L,
9695396959L, 9725997283L, 9793197943L, 9877398779L,
9898198993L, 9934999367L, 9976199767L, 100043100049L,
100703100733L, 100811100823L, 101341101347L, 101477101483L,
101873101879L, 102149102161L, 102587102593L, 102983103001L,
103511103529L, 103613103619L, 104207104231L, 104417104459L,
104723104729L, 104947104953L, 105031105037L, 106123106129L,
106243106261L, 106307106319L, 106373106391L, 106531106537L,
107021107033L, 107641107647L, 107981107999L, 108089108107L,
108517108529L, 109891109897L, 109943109961L, 110441110459L,
110927110933L, 112019112031L, 112061112067L, 112261112279L,
112831112843L, 114013114031L, 114547114553L, 115727115733L,
116101116107L, 116141116159L, 116747116789L, 117659117671L,
117991118033L, 118621118633L, 118891118897L, 119191119227L,
120181120193L, 120623120641L, 121351121357L, 122971123001L,
123493123499L, 123619123631L, 123887123911L, 123983123989L,
124291124297L, 124529124541L, 124543124561L, 125063125093L,
125527125539L, 125753125777L, 126199126211L, 126751126757L,
127703127709L, 127763127781L, 127819127837L, 128341128347L,
129737129749L, 130057130069L, 130643130649L, 131507131519L,
131743131749L, 131849131861L, 132257132263L, 132541132547L,
133321133327L, 133451133481L, 133657133669L, 134741134753L,
135271135277L, 135449135461L, 136261136273L, 136373136379L,
136483136501L, 136999137029L, 137119137131L, 137353137359L,
137363137369L, 138059138071L, 138739138763L, 139133139169L,
139837139861L, 140557140587L, 141551141587L, 141833141851L,
142537142543L, 142973142979L, 143357143387L, 143419143443L,
143477143483L, 143779143791L, 144593144611L, 145213145219L,
146173146191L, 146477146513L, 146701146719L, 147151147163L,
147179147197L, 147481147487L, 148249148279L, 148381148387L,
148793148817L, 149893149899L, 150197150203L, 150517150523L,
151051151057L, 151433151451L, 151597151603L, 151787151799L,
152519152531L, 152909152939L, 153457153469L, 154823154841L,
156707156719L, 157679157721L, 157733157739L, 157901157907L,
158329158341L, 158791158803L, 159023159059L, 159073159079L,
159473159491L, 159541159553L, 159773159779L, 161033161039L,
161047161053L, 161971161977L, 162017162053L, 162119162143L,
162209162221L, 162451162457L, 162671162677L, 162823162829L,
163243163249L, 163259163307L, 163627163633L, 163847163853L,
164267164279L, 164309164321L, 164963164987L, 165161165173L,
166247166259L, 166357166363L, 166931166949L, 167261167267L,
168937168943L, 169321169327L, 169483169489L, 169633169639L,
169859169889L, 170341170347L, 170551170557L, 171673171679L,
172993172999L, 173933173969L, 174653174659L, 174703174721L,
175361175391L, 175853175859L, 176237176243L, 176611176629L,
177211177217L, 177257177269L, 177791177797L, 177811177823L,
177943177949L, 178489178501L, 178819178831L, 179651179657L,
179693179717L, 180247180259L, 181669181693L, 182537182549L };
System.out.println(r[new Scanner(System.in).nextInt() - 1]);
}
}