Problem:


Problem D : Numbers 

n が与えられるので、n 個の連続した正の整数を求めよ。
ただしすべての数が、１とその数自身以外の約数をもたなくてはならない。

Input

入力は以下のフォーマットで与えられる。

n

入力は以下の制約を満たす。

1 ≤ n ≤ 1,500

Output

最初の行に、あなたが選んだ連続したn 個の正の整数の中で一番小さいものを出力せよ。

2行目からn+1 行目に、それぞれの値に対する約数を出力せよ。

約数は1かその数自身でなければどの値を出力しても良い。

1行目に出力した数をxとして、i行目には x+i-2 の約数を出力せよ。

出力する値は5,000桁を超えてはいけない。

Sample Input 1

2

Sample Output 1

8
2
3

Sample Input 2

3

Sample Output 2

8
2
3
5

Hint

Sample Output 2では、8,9,10を3個の連続した整数として選んでいる。

2行目に、8の約数として2,3行目は9の約数として3,４行目には10の約数として5,を出力している。



Sample input:
2


Sample output:
8
2
3

Submission status: Wrong Answer

Solution code:
# Edit: 2014/10/13
# Lang: Python3
# Time: 00.xxs

# File: pc1503.py

from functools import reduce

if __name__ == "__main__":
    n = int(input()) # 1<=n<=1,500
    #n1500 = reduce(lambda x,y: x*y, range(2,1501))+2
    n1500 = 48119977967797748601669900935813797818348080406726138081308559411630575189001095591292230585206733851868464009619343585194052091124618166270271481881393331431627962810299844149333789044689395510487167879769325303699470467829234399263326545652860748605075746366928323606645492277541120083438086727369377887676000211405318480244354207419604864176969950581435222198851194568984095705945549589054568321792338919149442985919957734792959402499096845643020401869381175603964424333222114125974374817804242633309769804293952870034619354125014210045647664063240162007560108665290568646128342557147350985358724154623253371867470765120422073867963935775258692109753041762094343569050497470353531764481503174750911858230906998361066084787758316110585736013365377431860738572261325738233656835271947352695180865573043834027955539012765489372645042504406597752357481931532872356635411224578334040522294746402829585458478708778346379431862368824819009177091444034885941394319343910223168655869761799669075059527608502465593181398566214786801211651657222004123456498258513120359126022843038535083709796101565934859483203933443308601475813108363074118562404412420191947127585482919172173045961122122701434297870691932154082986945954748251105782181586397275820342101470457300633590139512919549474113721711616912519714191760699935509810254849967087635936181176363954224186031346682928878492872249485456690138831610135377916327940503701400290125509132140782614640495733518048670983360134097860364762638658894873174499870133559364805443430831459505987809215393353387232078177562975021460595422358573128085417162336030235138652735438053034531962620811566019896879275257163988352090874930346115518331202927263708446729394381879888839549731876978682249320628599631628662375508826209854754631984276392670919216923002770077734756077549035942976209159416211581439461484509549370357486770276807687544580164314647595031368948490282897173328013518435758700056425922638411889496527975846052717958044813737086806600171993703579485864029383208714528950303253881360812631162134750100307772634337467012820470715650810714689905121432259528505483053930402217400686061612471659630192434864094539828085677465383026128353771071152304197549798870706139893609140045659756285435787771636258253666592102151236142132724425850991205720020493660580896600891888594659612927724357866265934517615841298789154462249169688860092640284756382431746120357767933119589280468687348061788072986362788582227019465263474828590646048451070702923434422714349595857654843699542321849363652767771978314681013589442955219879702008068934096624650625769705233333462826013860098698155180331145365652453482955497979915586438474687345677874451117702250441711504844638414485210092261397271970571029038581873069951161330495772310508760528249706514238384269808639507080418298318311361373628512041716415196868334254119137139589149597210032153545941114666530498906529240798164804007394775927836045668573993316428972539932745757171947402454257142633700815922407278403640595355142075599446056337986717212316223257763412164180899532722039383244462511410346646148863397237096276822656157561194665545757017429842404840309758925618650507921043007241637877939825811059339138925526124514467627126548126795078784022672860886251974581362141782786407402896309678008909663263987018538107050886193489012497405005820727271232733728141775132722013860591169620692789290456794698409808557447756701311883266010859016027592252397754508251628808293537776536569608111330584797160694847898923196743970244451842702266403326317319092117151143971679500042590269255093130215984418097418435474300467281949798227102529873732749027992079700287275900856241172902880909546551703263202853584498085358955307673717177961902081098618729046348849060249600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
    #print(n1500)
    for i in range(0,n):
        print(i+2)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1
for i in range(2,2+n):
    ans*=i


print(ans-n-1)
for i in range(n+1,1,-1):
    print(i)

Submission status: Wrong Answer

Solution code:
def main():
    num = 1
    i = 3
    for _ in range(1500//2):
        num *= i
        i += 2

    n = int(input())
    print(num)
    for i in range(n):
        print(i+2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    num = 2
    i = 3
    for _ in range(1500//2):
        num *= i
        i += 2

    n = int(input())
    print(num)
    for i in range(n):
        a = i+2
        if i%2 == 0:
            a = 2
        print(a)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

def check(n):
    if n == 2 or n == 3:
        return False
    if n%2 == 0 or n%3==0:
        return True
    return any(n % i == 0 for i in range(2, int(math.sqrt(n))+1))

n = int(sys.stdin.readline().rstrip())
c = 0
i = 4
while True:
    if check(i):
        c += 1
        if c == n:
            break
    else:
        c = 0
    i+=1
print(i-n+1)
for j in range(i-n+1, i+1):
    print(max(k for k in range(2, int(math.sqrt(j))+1) if j % k == 0))

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

def check(n):
    return [i for i in range(2, int(math.sqrt(n))+1) if n % i == 0]

n = int(sys.stdin.readline().rstrip())
i = 4
r = []
while True:
    res = check(i)
    if len(res) > 0:
        r.append(max(res))
        if len(r) == n:
            break
    else:
        r = []
    i+=1
print(i-n+1)
for d in r:
    print(d)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

def check(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            return i
    return 0

n = int(sys.stdin.readline().rstrip())
i = 4
r = []
while True:
    res = check(i)
    if res > 0:
        r.append(res)
        if len(r) == n:
            break
    else:
        r = []
    i+=1
print(i-n+1)
for d in r:
    print(d)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

prime_list = [2,3]

n = int(sys.stdin.readline().rstrip())
i = 4
r = []
while True:
    ret = 0
    for prime in prime_list:
        if i % prime == 0:
            ret = int(i/prime)
            break
    if ret > 0:
        r.append(ret)
        if len(r) == n:
            break
    else:
        prime_list.append(i)
        r = []
    i+=1
print(i-n+1)
for d in r:
    print(d)

Submission status: Accepted

Solution code:
# AOJ 1503: Numbers
# Python3 2018.7.13 bal4u

import sys
n = int(input())
if n == 1: print(4, 2, sep='\n'); sys.exit(0)
ans = 1
for i in range(2, n+2): ans *= i
print(ans+2)
for i in range(2, n+2): print(i)

Submission status: Accepted

Solution code:
print reduce( lambda x, y: x*y, [ x for x in range(1, 1501) ] )+2
for i in range(1, int(raw_input())+1): print i+1

Submission status: Accepted

Solution code:
# Edit: 2014/10/13
# Lang: Python3
# Time: 00.xxs

# File: pc1503.py

from functools import reduce

if __name__ == "__main__":
    n = int(input()) # 1<=n<=1,500
    #n1500 = reduce(lambda x,y: x*y, range(2,1501))+2
    n1500 = 48119977967797748601669900935813797818348080406726138081308559411630575189001095591292230585206733851868464009619343585194052091124618166270271481881393331431627962810299844149333789044689395510487167879769325303699470467829234399263326545652860748605075746366928323606645492277541120083438086727369377887676000211405318480244354207419604864176969950581435222198851194568984095705945549589054568321792338919149442985919957734792959402499096845643020401869381175603964424333222114125974374817804242633309769804293952870034619354125014210045647664063240162007560108665290568646128342557147350985358724154623253371867470765120422073867963935775258692109753041762094343569050497470353531764481503174750911858230906998361066084787758316110585736013365377431860738572261325738233656835271947352695180865573043834027955539012765489372645042504406597752357481931532872356635411224578334040522294746402829585458478708778346379431862368824819009177091444034885941394319343910223168655869761799669075059527608502465593181398566214786801211651657222004123456498258513120359126022843038535083709796101565934859483203933443308601475813108363074118562404412420191947127585482919172173045961122122701434297870691932154082986945954748251105782181586397275820342101470457300633590139512919549474113721711616912519714191760699935509810254849967087635936181176363954224186031346682928878492872249485456690138831610135377916327940503701400290125509132140782614640495733518048670983360134097860364762638658894873174499870133559364805443430831459505987809215393353387232078177562975021460595422358573128085417162336030235138652735438053034531962620811566019896879275257163988352090874930346115518331202927263708446729394381879888839549731876978682249320628599631628662375508826209854754631984276392670919216923002770077734756077549035942976209159416211581439461484509549370357486770276807687544580164314647595031368948490282897173328013518435758700056425922638411889496527975846052717958044813737086806600171993703579485864029383208714528950303253881360812631162134750100307772634337467012820470715650810714689905121432259528505483053930402217400686061612471659630192434864094539828085677465383026128353771071152304197549798870706139893609140045659756285435787771636258253666592102151236142132724425850991205720020493660580896600891888594659612927724357866265934517615841298789154462249169688860092640284756382431746120357767933119589280468687348061788072986362788582227019465263474828590646048451070702923434422714349595857654843699542321849363652767771978314681013589442955219879702008068934096624650625769705233333462826013860098698155180331145365652453482955497979915586438474687345677874451117702250441711504844638414485210092261397271970571029038581873069951161330495772310508760528249706514238384269808639507080418298318311361373628512041716415196868334254119137139589149597210032153545941114666530498906529240798164804007394775927836045668573993316428972539932745757171947402454257142633700815922407278403640595355142075599446056337986717212316223257763412164180899532722039383244462511410346646148863397237096276822656157561194665545757017429842404840309758925618650507921043007241637877939825811059339138925526124514467627126548126795078784022672860886251974581362141782786407402896309678008909663263987018538107050886193489012497405005820727271232733728141775132722013860591169620692789290456794698409808557447756701311883266010859016027592252397754508251628808293537776536569608111330584797160694847898923196743970244451842702266403326317319092117151143971679500042590269255093130215984418097418435474300467281949798227102529873732749027992079700287275900856241172902880909546551703263202853584498085358955307673717177961902081098618729046348849060249600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
    print(n1500)
    for i in range(0,n):
        print(i+2)

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
    print(4)
    print(2)
elif n==2:
    print(14)
    print(2)
    print(3)

else:
    ans=1
    for i in range(2,2+n):
        ans*=i


    print(ans-n-1)
    for i in range(n+1,1,-1):
        print(i)

Submission status: Accepted

Solution code:
from math import*
n=input()+1
a=factorial(n)
print a+2
for i in range(2,n+1):print i

Submission status: Accepted

Solution code:
import math
n=input()
print math.factorial(n+1)+2
for i in range(n):print i+2

Submission status: Accepted

Solution code:
import math;n=input();print math.factorial(n+1)+2
for i in range(n):print i+2

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

n = int(input())
if n == 1:
    # 4
    print(4)
    print(2)
elif n == 2:
    # 8, 9
    print(8)
    print(4)
    print(3)
else:
    a = 1
    for i in range(1, n + 2):
        a *= i
    print(a - n - 1)

    for i in range(n + 1, 1, -1):
        print(i)

Submission status: Accepted

Solution code:
A=[]
B=range(2, 1600)
while(B[0]<40):
    b=B.pop(0)
    A.append(b)
    B=[x for x in B if x%b!=0]
A+=B
C=range(2,1600)
for b in A:
    C=[b if c%b==0 else c for c in C]
N=reduce(lambda a,b: a*b, A)+2
print N
q=int(raw_input())
for i in range(q):
    print C[i]

Submission status: Accepted

Solution code:
def main():
    num = 2
    i = 3
    for _ in range(1500//2):
        num *= i
        i += 2

    n = int(input())
    print(num+2)
    for i in range(n):
        a = i+2
        if i%2 == 0:
            a = 2
        print(a)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
print reduce(lambda x,y: x*y, range(1,1501))+2
for i in range(2,input()+2):print i

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)
memo = {0:1}
def fact(num):
  if num in memo:return memo[num]
  memo[num] = num * fact(num - 1)
  return memo[num]
n = int(input())
print(fact(n + 1) + 2)
for i in range(n):
  print(i + 2)

Submission status: Accepted

Solution code:
import math
n=int(input())
print(math.factorial(n+1)+2)
for i in range(2,n+2):
    print(i)

Submission status: Runtime Error

Solution code:
import math

li = [i for i in xrange(4,1501)]

def prime_check(num):
    temp = 1
    flag = False
    while True:
        temp += 1
        if(temp > math.sqrt(num)):
            break
        if(num % temp == 0):
            flag = True
            break
    return flag

for i in li:
    if(prime_check(i) == False):
        li.remove(i)

n = input()
if(n == 1):
    print 4
    print 2
    exit()
count = 1
result = 0
for i in xrange(len(li)):
    if(count == n):
        result = li[i-n+1]
        break
    if(li[i] + 1 == li[i+1]):
        count += 1
    else:
        count = 1
print result
res_list = [result + i for i in xrange(n)]
for i in res_list:
    for x in xrange(2,1501):
        if(i % x == 0):
            print x
            break

Submission status: Runtime Error

Solution code:
import math

li = [4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 102, 104, 105, 106, 108, 110, 111, 112, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 132, 133, 134, 135, 136, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 164, 165, 166, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 180, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 194, 195, 196, 198, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 224, 225, 226, 228, 230, 231, 232, 234, 235, 236, 237, 238, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255, 256, 258, 259, 260, 261, 262, 264, 265, 266, 267, 268, 270, 272, 273, 274, 275, 276, 278, 279, 280, 282, 284, 285, 286, 287, 288, 289, 290, 291, 292, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 308, 309, 310, 312, 314, 315, 316, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 348, 350, 351, 352, 354, 355, 356, 357, 358, 360, 361, 362, 363, 364, 365, 366, 368, 369, 370, 371, 372, 374, 375, 376, 377, 378, 380, 381, 382, 384, 385, 386, 387, 388, 390, 391, 392, 393, 394, 395, 396, 398, 399, 400, 402, 403, 404, 405, 406, 407, 408, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 422, 423, 424, 425, 426, 427, 428, 429, 430, 432, 434, 435, 436, 437, 438, 440, 441, 442, 444, 445, 446, 447, 448, 450, 451, 452, 453, 454, 455, 456, 458, 459, 460, 462, 464, 465, 466, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 480, 481, 482, 483, 484, 485, 486, 488, 489, 490, 492, 493, 494, 495, 496, 497, 498, 500, 501, 502, 504, 505, 506, 507, 508, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 522, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 542, 543, 544, 545, 546, 548, 549, 550, 551, 552, 553, 554, 555, 556, 558, 559, 560, 561, 562, 564, 565, 566, 567, 568, 570, 572, 573, 574, 575, 576, 578, 579, 580, 581, 582, 583, 584, 585, 586, 588, 589, 590, 591, 592, 594, 595, 596, 597, 598, 600, 602, 603, 604, 605, 606, 608, 609, 610, 611, 612, 614, 615, 616, 618, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 632, 633, 634, 635, 636, 637, 638, 639, 640, 642, 644, 645, 646, 648, 649, 650, 651, 652, 654, 655, 656, 657, 658, 660, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 674, 675, 676, 678, 679, 680, 681, 682, 684, 685, 686, 687, 688, 689, 690, 692, 693, 694, 695, 696, 697, 698, 699, 700, 702, 703, 704, 705, 706, 707, 708, 710, 711, 712, 713, 714, 715, 716, 717, 718, 720, 721, 722, 723, 724, 725, 726, 728, 729, 730, 731, 732, 734, 735, 736, 737, 738, 740, 741, 742, 744, 745, 746, 747, 748, 749, 750, 752, 753, 754, 755, 756, 758, 759, 760, 762, 763, 764, 765, 766, 767, 768, 770, 771, 772, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 788, 789, 790, 791, 792, 793, 794, 795, 796, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 810, 812, 813, 814, 815, 816, 817, 818, 819, 820, 822, 824, 825, 826, 828, 830, 831, 832, 833, 834, 835, 836, 837, 838, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 854, 855, 856, 858, 860, 861, 862, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 878, 879, 880, 882, 884, 885, 886, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 908, 909, 910, 912, 913, 914, 915, 916, 917, 918, 920, 921, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 933, 934, 935, 936, 938, 939, 940, 942, 943, 944, 945, 946, 948, 949, 950, 951, 952, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 968, 969, 970, 972, 973, 974, 975, 976, 978, 979, 980, 981, 982, 984, 985, 986, 987, 988, 989, 990, 992, 993, 994, 995, 996, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1010, 1011, 1012, 1014, 1015, 1016, 1017, 1018, 1020, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1032, 1034, 1035, 1036, 1037, 1038, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1050, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1062, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1088, 1089, 1090, 1092, 1094, 1095, 1096, 1098, 1099, 1100, 1101, 1102, 1104, 1105, 1106, 1107, 1108, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1120, 1121, 1122, 1124, 1125, 1126, 1127, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1152, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1182, 1183, 1184, 1185, 1186, 1188, 1189, 1190, 1191, 1192, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1214, 1215, 1216, 1218, 1219, 1220, 1221, 1222, 1224, 1225, 1226, 1227, 1228, 1230, 1232, 1233, 1234, 1235, 1236, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1278, 1280, 1281, 1282, 1284, 1285, 1286, 1287, 1288, 1290, 1292, 1293, 1294, 1295, 1296, 1298, 1299, 1300, 1302, 1304, 1305, 1306, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1320, 1322, 1323, 1324, 1325, 1326, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1362, 1363, 1364, 1365, 1366, 1368, 1369, 1370, 1371, 1372, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1424, 1425, 1426, 1428, 1430, 1431, 1432, 1434, 1435, 1436, 1437, 1438, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1448, 1449, 1450, 1452, 1454, 1455, 1456, 1457, 1458, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1482, 1484, 1485, 1486, 1488, 1490, 1491, 1492, 1494, 1495, 1496, 1497, 1498, 1500]

n = input()

if(n == 1):
    print 4
    print 2
    exit()

count = 1
result = 0

for i in xrange(len(li)):
    if(count == n):
        result = li[i-n+1]
        break
    if(li[i] + 1 == li[i+1]):
        count += 1
    else:
        count = 1

print result

res_list = [result + i for i in xrange(n)]

for i in res_list:
    for x in xrange(2,1501):
        if(i % x == 0):
            print x
            break