sum (分块+欧拉筛+唯一分解定理+规律)

 

  •  1000ms
  •  512000K

A square-free integer is an integer which is indivisible by any square number except 1. For example, 6=2⋅3 is square-free, but 12=2^2⋅3 is not, because 2^2 is a square number. Some integers could be decomposed into product of two square-free integers, there may be more than one decomposition ways. For example, 6=1⋅6=6⋅1=2⋅3=3⋅2,n=ab and n=ba are considered different if a̸=b.f(n) is the number of decomposition ways that n=ab such that a and b are square-free integers. The problem is calculating f(1)+f(2)+...+f(n).

Input

The first line contains an integer T(T≤20), denoting the number of test cases.

For each test case, there first line has a integer n(n≤2⋅10^7).

Output

For each test case, print the answer f(1)+f(2)+...+f(n) .

Hint

∑​f(i)=f(1)+⋯+f(8)
=1+2+2+1+2+4+2+0=14=1+2+2+1+2+4+2+0=14.

样例输入

2

5

8

样例输出

8
14

题目来源

ACM-ICPC 2018 南京赛区网络预赛

 思路:

仔细读题目后发现对于一个数n的唯一分解式:n=a^ai*b^bi*c^ci....z*zi.

如果分解式中存在指数>2,ans=0;否则ans=2^cnt(其中cnt为指数为1的个数)

遇到的问题:

然后就陷入了无休止的超时,因为没有用到分块和欧拉筛,导致复杂度过大.还是赛后看了别人的题解才知道要用分块和欧拉筛(惭愧...)

代码来自:https://blog.csdn.net/Du_Mingm/article/details/82290297

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int vis[10005];
int prim[2000];
int Pr_cnt,Pr_mn = 10000;
int Fx[4500]={
0,17921,38137,59181,80848,102872,125270,147934,170775,193866,217234,240689,264322,288032,311883,335863,359901,384097,408378,432831,457331,481959,506532,531356,556059,580907,605830,630748,655840,680989,706174,731351,756642,781920,807273,832700,858120,883685,909213,934870,960454,986196,1011880,1037700,1063455,1089278,1115255,1141113,1167032,1193017,1219050,1245092,1271178,1297322,1323389,1349501,1375800,1402089,1428344,1454666,1480961,1507264,1533710,1560146,1586606,1613019,1639464,1665975,1692566,1719147,1745699,1772284,1798902,1825617,1852237,1878901,1905589,1932335,1959162,1985842,2012689,2039543,2066284,2093211,2119967,2146900,2173869,2200739,2227739,2254654,2281627,2308658,2335708,2362716,2389795,2416891,2443980,2471109,2498214,2525408,2552593,2579830,2607052,2634258,2661454,2688763,2716086,2743297,2770542,2797879,2825149,2852486,2879911,2907319,2934739,2962053,2989507,3016917,3044415,3071818,3099268,3126850,3154375,3181863,3209381,3236977,3264528,3292056,3319700,3347275,3374865,3402356,3430042,3457591,3485348,3513040,3540765,3568513,3596266,3623894,3651709,3679371,3707202,3735013,3762770,3790556,3818420,3846087,3873941,3901673,3929625,3957520,3985340,4013276,4041145,4068937,4096913,4124897,4152751,4180769,4208711,4236691,4264637,4292604,4320457,4348393,4376525,4404537,4432531,4460460,4488614,4516647,4544690,4572894,4600921,4629046,4657095,4685252,4713351,4741593,4769651,4797789,4825917,4854032,4882161,4910459,4938591,4966785,4995074,5023268,5051589,5079777,5108018,5136283,5164620,5192837,5221101,5249433,5277778,5306181,5334443,5362697,5391122,5419473,5447843,5476206,5504564,5532935,5561307,5589743,5618209,5646559,5674982,5703327,5731851,5760204,5788651,5817043,5845565,5874096,5902533,5930991,5959510,5988036,6016554,6045121,6073628,6102144,6130773,6159297,6187788,6216369,6244852,6273387,6302091,6330738,6359275,6387881,6416377,6445016,6473665,6502303,6531002,6559704,6588373,6616865,6645544,6674203,6702898,6731556,6760299,6788894,6817591,6846308,6874969,6903767,6932438,6961151,6989865,7018721,7047482,7076147,7104861,7133697,7162533,7191386,7219987,7248948,7277726,7306377,7335260,7364103,7392955,7421818,7450688,7479510,7508416,7537327,7566105,7594976,7623930,7652801,7681505,7710564,7739447,7768459,7797329,7826144,7855121,7884006,7912960,7941983,7970875,7999831,8028645,8057764,8086595,8115672,8144594,8173687,8202561,8231718,8260667,8289640,8318559,8347663,8376800,8405767,8434848,8463875,8492810,8521903,8550948,8580111,8609263,8638339,8667346,8696582,8725625,8754713,8783790,8813013,8841994,8871009,8900227,8929370,8958447,8987708,9016663,9045783,9074967,9104125,9133275,9162264,9191566,9220747,9250025,9279129,9308254,9337576,9366712,9395891,9425104,9454352,9483475,9512758,9542091,9571254,9600502,9629861,9659011,9688341,9717519,9746892,9776226,9805351,9834584,9863868,9893333,9922525,9951785,9981100,10010513,10039682,10069124,10098375,10127608,10156999,10186148,10215627,10245001,10274317,10303540,10332966,10362331,10391642,10421107,10450495,10479922,10509247,10538635,10567987,10597347,10626805,10656175,10685596,10715105,10744450,10773977,10803344,10832709,10862229,10891617,10921035,10950363,10979652,11009247,11038859,11068279,11097624,11127257,11156555,11186177,11215632,11245103,11274664,11304136,11333649,11363093,11392480,11422104,11451607,11481116,11510703,11540295,11569831,11599344,11628979,11658435,11687915,11717508,11746945,11776490,11806019,11835727,11865308,11894757,11924510,11954116,11983577,12013273,12042818,12072415,12101941,12131538,12161259,12190779,12220466,12250110,12279677,12309336,12338937,12368566,12398214,12427805,12457502,12487141,12516815,12546463,12576132,12605811,12635448,12665070,12694831,12724533,12754134,12783951,12813552,12843283,12872969,12902691,12932336,12962023,12991642,13021321,13051083,13080704,13110564,13140273,13169988,13199814,13229581,13259185,13289053,13318700,13348429,13378161,13407938,13437702,13467505,13497342,13527045,13556709,13586602,13616399,13646175,13676027,13705637,13735520,13765383,13795058,13824959,13854739,13884527,13914336,13944149,13973900,14003709,14033700,14063379,14093234,14123128,14152950,14182691,14212572,14242471,14272433,14302186,14331976,14361796,14391762,14421597,14451340,14481231,14511044,14541049,14570852,14600820,14630809,14660662,14690564,14720431,14750386,14780333,14810275,14840178,14870183,14900083,14930055,14960043,14990005,15019833,15049775,15079678,15109757,15139726,15169611,15199512,15229415,15259379,15289462,15319456,15349368,15379177,15409294,15439257,15469252,15499295,15529258,15559236,15589121,15619228,15649196,15679188,15709367,15739255,15769219,15799225,15829214,15859329,15889346,15919295,15949336,15979397,16009367,16039338,16069463,16099484,16129470,16159574,16189750,16219675,16249721,16279733,16309880,16339833,16369997,16400061,16430194,16460357,16490344,16520486,16550629,16580734,16610659,16640731,16670822,16700965,16730994,16761161,16791316,16821422,16851564,16881716,16911806,16941978,16972012,17002287,17032437,17062485,17092506,17122719,17152861,17183033,17213206,17243294,17273446,17303508,17333638,17363977,17394172,17424392,17454494,17484631,17514774,17545017,17575250,17605353,17635642,17665777,17695973,17726183,17756454,17786599,17816806,17847109,17877288,17907474,17937628,17967899,17998138,18028403,18058585,18088905,18119021,18149260,18179527,18209660,18239967,18270223,18300470,18330777,18361087,18391316,18421499,18451798,18481975,18512249,18542528,18572765,18603087,18633287,18663614,18693926,18724211,18754414,18784834,18814990,18845228,18875650,18906023,18936176,18966606,18996845,19027075,19057389,19087631,19118081,19148327,19178698,19209005,19239086,19269633,19299979,19330228,19360634,19391003,19421314,19451587,19482008,19512375,19542728,19573038,19603467,19633845,19664246,19694481,19724953,19755299,19785739,19816017,19846440,19876836,19907200,19937535,19967882,19998297,20028808,20059143,20089426,20119891,20150388,20180781,20211191,20241592,20272052,20302600,20332986,20363403,20393715,20424222,20454493,20484887,20515380,20545753,20576116,20606605,20637058,20667396,20697849,20728176,20758745,20789257,20819819,20850218,20880666,20910961,20941469,20972073,21002447,21033016,21063353,21093903,21124302,21154869,21185229,21215718,21246254,21276706,21307333,21337684,21368194,21398763,21429210,21459535,21490013,21520536,21550986,21581604,21612082,21642501,21673055,21703644,21734180,21764752,21795301,21825882,21856355,21886778,21917307,21947862,21978282,22008792,22039422,22069936,22100464,22131048,22161669,22192028,22222612,22253139,22283707,22314261,22344733,22375397,22406032,22436572,22467116,22497749,22528366,22558873,22589589,22620181,22650658,22681342,22711633,22742344,22772902,22803459,22834020,22864579,22895117,22925751,22956485,22987109,23017700,23048237,23078808,23109379,23140145,23170758,23201420,23231903,23262678,23293393,23323876,23354489,23385087,23415805,23446339,23477140,23507718,23538387,23568938,23599629,23630266,23660865,23691489,23722067,23752728,23783477,23814214,23844802,23875381,23906096,23936760,23967405,23998296,24028908,24059566,24090340,24120999,24151615,24182241,24212998,24243716,24274335,24305108,24335616,24366453,24397092,24427821,24458423,24489210,24519811,24550488,24581143,24612134,24642761,24673537,24704262,24734882,24765559,24796375,24827174,24857841,24888523,24919264,24949953,24980604,25011469,25042273,25072936,25103814,25134577,25165358,25195937,25226728,25257479,25288237,25319103,25349844,25380559,25411347,25442131,25472821,25503596,25534272,25565057,25595786,25626653,25657447,25688171,25718854,25749736,25780648,25811335,25842160,25872750,25903655,25934487,25965229,25996058,26026942,26057687,26088561,26119364,26150113,26180868,26211643,26242440,26273294,26304146,26335046,26365701,26396644,26427376,26458139,26489051,26519791,26550582,26581477,26612274,26643102,26673975,26704756,26735594,26766474,26797327,26828200,26859010,26889835,26920636,26951535,26982307,27013216,27043948,27074895,27105674,27136653,27167360,27198270,27229169,27260088,27290968,27321758,27352583,27383365,27414447,27445388,27476192,27507195,27537929,27568832,27599619,27630670,27661484,27692408,27723212,27754185,27785131,27816096,27846931,27877903,27908648,27939625,27970542,28001592,28032517,28063381,28094412,28125323,28156144,28187232,28217896,28248933,28279796,28310956,28341696,28372647,28403616,28434525,28465387,28496242,28527228,28558104,28589093,28619948,28651107,28682055,28712962,28744093,28774878,28805886,28836848,28867717,28898592,28929572,28960615,28991511,29022481,29053418,29084354,29115482,29146346,29177521,29208562,29239415,29270301,29301120,29332177,29363309,29394257,29425344,29456239,29487138,29518001,29549140,29580071,29611105,29642199,29673188,29704285,29735229,29766104,29797079,29828198,29859212,29890216,29921221,29952212,29983204,30014249,30045200,30076267,30107331,30138272,30169315,30200331,30231356,30262403,30293472,30324428,30355583,30386501,30417657,30448689,30479618,30510677,30541740,30572744,30603843,30634920,30665923,30697027,30728196,30759191,30790280,30821366,30852417,30883559,30914690,30945784,30977013,31007864,31038980,31069987,31101062,31132296,31163386,31194363,31225525,31256558,31287496,31318643,31349726,31380817,31411903,31442974,31474151,31505195,31536251,31567434,31598565,31629722,31660702,31691839,31722992,31754139,31785053,31816327,31847596,31878667,31909665,31940854,31971917,32003006,32034200,32065240,32096413,32127422,32158502,32189668,32220831,32251874,32283168,32314261,32345443,32376446,32407592,32438641,32469994,32501003,32532219,32563300,32594353,32625739,32656839,32688037,32719236,32750401,32781433,32812560,32843649,32874908,32906110,32937123,32968416,32999557,33030559,33061858,33093085,33124248,33155410,33186512,33217733,33248938,33280060,33311399,33342378,33373671,33405063,33436064,33467226,33498443,33529581,33560630,33592014,33623173,33654427,33685586,33716801,33747891,33779223,33810348,33841647,33872834,33903986,33935275,33966436,33997569,34028817,34060026,34091215,34122440,34153732,34184971,34216248,34247538,34278750,34309780,34341191,34372426,34403606,34434861,34465928,34497359,34528543,34559622,34591026,34622241,34653525,34684676,34715963,34747228,34778490,34809923,34841076,34872326,34903626,34934773,34966038,34997316,35028476,35059839,35091124,35122184,35153504,35184762,35216067,35247408,35278663,35309807,35341128,35372433,35403684,35435096,35466360,35497671,35529056,35560240,35591591,35622832,35654201,35685361,35716756,35748010,35779345,35810577,35841941,35873214,35904405,35935749,35967044,35998421,36029755,36061043,36092361,36123686,36154915,36186310,36217584,36248863,36280222,36311461,36342767,36374096,36405285,36436632,36468068,36499311,36530632,36561969,36593403,36624721,36656045,36687440,36718760,36750080,36781447,36812834,36844229,36875457,36906832,36938154,36969489,37000889,37032282,37063547,37094884,37126284,37157703,37188991,37220287,37251563,37282888,37314196,37345619,37376974,37408318,37439713,37471118,37502528,37533766,37565265,37596640,37627911,37659289,37690562,37721965,37753348,37784704,37816144,37847512,37878879,37910320,37941700,37972993,38004428,38035881,38067227,38098726,38129940,38161329,38192833,38224284,38255629,38286990,38318378,38349834,38381370,38412803,38444211,38475665,38506922,38538319,38569744,38601126,38632553,38664082,38695499,38726851,38758287,38789782,38821231,38852660,38884116,38915523,38946780,38978259,39009781,39041223,39072728,39104153,39135485,39166863,39198251,39229756,39261209,39292685,39324140,39355642,39387185,39418607,39449970,39481435,39512866,39544310,39575636,39607139,39638778,39670264,39701602,39733177,39764642,39796073,39827459,39858978,39890457,39921918,39953392,39984896,40016205,40047603,40079038,40110734,40142149,40173540,40205051,40236435,40268091,40299593,40331110,40362643,40394015,40425434,40456801,40488388,40520052,40551405,40583021,40614490,40646026,40677528,40708815,40740374,40772087,40803515,40835042,40866441,40898105,40929471,40960930,40992528,41024081,41055628,41087050,41118477,41150172,41181505,41213023,41244534,41276223,41307607,41339090,41370792,41402225,41433784,41465317,41496811,41528313,41559840,41591304,41623013,41654551,41685990,41717393,41748907,41780353,41811884,41843608,41875107,41906599,41938225,41969682,42001349,42032846,42064366,42095985,42127356,42158870,42190516,42222272,42253719,42285352,42316843,42348353,42380048,42411465,42443076,42474802,42506274,42537813,42569346,42601000,42632508,42664114,42695579,42727195,42758629,42790335,42821843,42853424,42885005,42916649,42948118,42979697,43011353,43042919,43074647,43106134,43137672,43169227,43200885,43232555,43264064,43295666,43327323,43358823,43390462,43422119,43453695,43485301,43516894,43548632,43580166,43611781,43643375,43674998,43706629,43738246,43769838,43801212,43833037,43864760,43896341,43927975,43959590,43991109,44022748,44054346,44085990,44117712,44149213,44180952,44212584,44244157,44275774,44307528,44339037,44370613,44402346,44434100,44465662,44497300,44528902,44560557,44592048,44623627,44655279,44686868,44718501,44750205,44781955,44813499,44845182,44876917,44908372,44940184,44971807,45003429,45035164,45066819,45098427,45130138,45161769,45193484,45225048,45256768,45288322,45320191,45351744,45383464,45415174,45446809,45478375,45509932,45541718,45573409,45605072,45636869,45668551,45700191,45731916,45763500,45795243,45826975,45858586,45890279,45921957,45953600,45985508,46017137,46048740,46080446,46112030,46143736,46175349,46207112,46238827,46270433,46302163,46333825,46365480,46397101,46429075,46460544,46492223,46524162,46555794,46587472,46619015,46650852,46682673,46714375,46746151,46777855,46809540,46841359,46873029,46904654,46936471,46968207,46999988,47031730,47063478,47095054,47126919,47158667,47190333,47221930,47253776,47285291,47317273,47348938,47380668,47412417,47444181,47475931,47507586,47539567,47571197,47602978,47634704,47666389,47698105,47729834,47761622,47793388,47825149,47856928,47888563,47920305,47952074,47983756,48015569,48047392,48079078,48110946,48142631,48174339,48206149,48237949,48269742,48301479,48333374,48365146,48396872,48428637,48460405,48492026,48523834,48555578,48587341,48619136,48650997,48682849,48714394,48746274,48778017,48809911,48841549,48873398,48905155,48937053,48968757,49000549,49032198,49064039,49095620,49127666,49159476,49191279,49223028,49254935,49286743,49318581,49350276,49382111,49413958,49445722,49477628,49509456,49541115,49572980,49604856,49636703,49668441,49700178,49732051,49763719,49795604,49827280,49859136,49891135,49923001,49954794,49986379,50018303,50050150,50081964,50113906,50145659,50177361,50209269,50240991,50272772,50304539,50336430,50368410,50400194,50432007,50463730,50495721,50527551,50559387,50591116,50623022,50654887,50686847,50718631,50750414,50782341,50814120,50845924,50877670,50909656,50941379,50973384,51005136,51036911,51068693,51100705,51132530,51164512,51196225,51228213,51259985,51291924,51323648,51355547,51387434,51419306,51451079,51482971,51514726,51546725,51578603,51610535,51642213,51674216,51706041,51737757,51769760,51801674,51833509,51865396,51897188,51929125,51960953,51992798,52024669,52056743,52088667,52120445,52152372,52184387,52216142,52248182,52280030,52312028,52343823,52375773,52407591,52439533,52471374,52503323,52535282,52567102,52599020,52630919,52662745,52694808,52726536,52758550,52790504,52822399,52854284,52886234,52918088,52949969,52981882,53013862,53045802,53077576,53109623,53141462,53173295,53205277,53237173,53269056,53301167,53332936,53364804,53396812,53428700,53460519,53492572,53524406,53556278,53588477,53620294,53652299,53684043,53716099,53747921,53779960,53811672,53843721,53875743,53907506,53939477,53971415,54003404,54035448,54067394,54099458,54131316,54163117,54195247,54227122,54259025,54291013,54323066,54355054,54386907,54418834,54450706,54482656,54514644,54546499,54578509,54610588,54642431,54674459,54706326,54738238,54770386,54802347,54834289,54866272,54898150,54930143,54961928,54993848,55025850,55058027,55089933,55121898,55153770,55185960,55217774,55249815,55281758,55313622,55345586,55377607,55409672,55441679,55473765,55505683,55537698,55569558,55601613,55633447,55665631,55697516,55729517,55761645,55793416,55825456,55857261,55889352,55921418,55953322,55985416,56017408,56049436,56081523,56113489,56145427,56177516,56209326,56241435,56273544,56305494,56337478,56369389,56401370,56433424,56465326,56497456,56529501,56561520,56593577,56625577,56657737,56689783,56721745,56753749,56785739,56817703,56849708,56881741,56913625,56945704,56977844,57009739,57041873,57073833,57105854,57138024,57169893,57202007,57233936,57265967,57298143,57330063,57362018,57394059,57426155,57458249,57490207,57522380,57554303,57586202,57618302,57650288,57682467,57714644,57746650,57778623,57810763,57842772,57874778,57906909,57938870,57970862,58002975,58035085,58067014,58099095,58131291,58163361,58195515,58227592,58259613,58291815,58323785,58355844,58387865,58419945,58451996,58484054,58516091,58548177,58580345,58612260,58644368,58676467,58708559,58740550,58772507,58804633,58836911,58868964,58900973,58933103,58965197,58997293,59029344,59061297,59093405,59125452,59157584,59189635,59221771,59253873,59286054,59318076,59350051,59382125,59414258,59446383,59478373,59510651,59542764,59574945,59606844,59638970,59671098,59703094,59735303,59767317,59799428,59831556,59863699,59895845,59927950,59960033,59992003,60024035,60056116,60088218,60120211,60152343,60184623,60216874,60248885,60281077,60313183,60345249,60377452,60409600,60441653,60473863,60506015,60538185,60570154,60602207,60634334,60666470,60698608,60730741,60762804,60794932,60827061,60859129,60891181,60923407,60955514,60987725,61019895,61052055,61084186,61116259,61148452,61180428,61212774,61244748,61276923,61308943,61341164,61373182,61405389,61437427,61469534,61501709,61533843,61566017,61598320,61630440,61662601,61694715,61726875,61758964,61791085,61823325,61855522,61887668,61919762,61951957,61984198,62016306,62048456,62080574,62112747,62144878,62177092,62209251,62241363,62273486,62305664,62337845,62370122,62402210,62434270,62466662,62498929,62531088,62563208,62595508,62627519,62659728,62692004,62724063,62756249,62788357,62820571,62852812,62884913,62917177,62949399,62981564,63013704,63046080,63078147,63110351,63142438,63174504,63206766,63238933,63271105,63303325,63335436,63367705,63399797,63432084,63464398,63496365,63528693,63560909,63593117,63625353,63657577,63689646,63721791,63754034,63786208,63818424,63850797,63882913,63915038,63947271,63979395,64011627,64043834,64076125,64108392,64140670,64172942,64205169,64237351,64269632,64301839,64333843,64366243,64398433,64430584,64462745,64494961,64527177,64559560,64591738,64623797,64655945,64688227,64720581,64753046,64785214,64817327,64849625,64881917,64914060,64946372,64978529,65010624,65042784,65075082,65107327,65139522,65171860,65204028,65236228,65268471,65300751,65332946,65365255,65397473,65429727,65461856,65494241,65526485,65558786,65591020,65623225,65655387,65687732,65719935,65752289,65784457,65816844,65848891,65881103,65913346,65945650,65977938,66010056,66042199,66074560,66106732,66139230,66171615,66203772,66236046,66268003,66300513,66332948,66365190,66397502,66429695,66462021,66494201,66526442,66558685,66590987,66623228,66655438,66687720,66720005,66752154,66784424,66816812,66849216,66881404,66913516,66945985,66978090,67010442,67042958,67075189,67107502,67139688,67171977,67204333,67236684,67268772,67300979,67333500,67365628,67397898,67430191,67462682,67494838,67527041,67559475,67591649,67623865,67656200,67688563,67720733,67753171,67785572,67817658,67850132,67882345,67914635,67947113,67979258,68011610,68043858,68076123,68108273,68140719,68173082,68205421,68237604,68269934,68302338,68334553,68367079,68399244,68431424,68463862,68496100,68528483,68560762,68592994,68625209,68657591,68690014,68722322,68754663,68786906,68819280,68851526,68883923,68916187,68948472,68980833,69013167,69045577,69077866,69110188,69142474,69174884,69207338,69239726,69271844,69304377,69336667,69369035,69401461,69433886,69466094,69498425,69530706,69563088,69595520,69627758,69660154,69692390,69724567,69757095,69789431,69821740,69854091,69886370,69918808,69951124,69983397,70015723,70048032,70080428,70112684,70145136,70177585,70210042,70242254,70274863,70307083,70339409,70371726,70403973,70436339,70468582,70501018,70533203,70565821,70598048,70630473,70662887,70695161,70727498,70759832,70792197,70824671,70856921,70889263,70921681,70954140,70986540,71018885,71051205,71083617,71115914,71148295,71180885,71213286,71245486,71277721,71310207,71342765,71374880,71407324,71439634,71472056,71504312,71536709,71569192,71601342,71633850,71666299,71698728,71731042,71763488,71795888,71828230,71860771,71893031,71925375,71957774,71990212,72022590,72055023,72087396,72119829,72152247,72184531,72217000,72249528,72281869,72314458,72346762,72379152,72411469,72443851,72476202,72508715,72540949,72573379,72605829,72638095,72670667,72702982,72735350,72767740,72800343,72832614,72864960,72897477,72929771,72962081,72994548,73027016,73059470,73091743,73124141,73156716,73189088,73221457,73253778,73286242,73318758,73351143,73383499,73415928,73448418,73480762,73513214,73545669,73578061,73610508,73643011,73675491,73707909,73740300,73772761,73805263,73837615,73870151,73902427,73934896,73967443,73999909,74032238,74064822,74097170,74129663,74162048,74194462,74226938,74259452,74291802,74324292,74356833,74389175,74421882,74454066,74486621,74519009,74551430,74583745,74616299,74648759,74681114,74713680,74746246,74778695,74810987,74843587,74875992,74908524,74940915,74973232,75005720,75038124,75070555,75103093,75135494,75168010,75200390,75232848,75265447,75297729,75330466,75362747,75395269,75427687,75460184,75492493,75525041,75557512,75589906,75622420,75654921,75687252,75719698,75752337,75784687,75817175,75849644,75882019,75914591,75946914,75979548,76012084,76044500,76077023,76109451,76142052,76174390,76206878,76239394,76271985,76304347,76336788,76369456,76401776,76434247,76466937,76499477,76531866,76564214,76596634,76629157,76661760,76694166,76726565,76759077,76791689,76824264,76856627,76889129,76921575,76954043,76986549,77019100,77051687,77084007,77116510,77148904,77181652,77214153,77246706,77279114,77311707,77344239,77376525,77409108,77441618,77474230,77506671,77539171,77571641,77604024,77636621,77669215,77701742,77734182,77766636,77799148,77831769,77864229,77896776,77929280,77961722,77994219,78026871,78059355,78092052,78124480,78156852,78189233,78222021,78254507,78287000,78319598,78352062,78384661,78417034,78449744,78482153,78514691,78547149,78579618,78612151,78644733,78677389,78709897,78742379,78775014,78807447,78840111,78872524,78905040,78937516,78970052,79002683,79035109,79067550,79100156,79132550,79164967,79197422,79230080,79262577,79295207,79327855,79360396,79392863,79425621,79458028,79490524,79523028,79555738,79588123,79620633,79653072,79685826,79718378,79751027,79783742,79816286,79848943,79881449,79913951,79946550,79979092,80011786,80044323,80076765,80109321,80141906,80174496,80207093,80239568,80272004,80304836,80337227,80369889,80402344,80435030,80467590,80499976,80532547,80565291,80597832,80630463,80663007,80695677,80728230,80760778,80793273,80826038,80858342,80890846,80923506,80956107,80988826,81021318,81053691,81086373,81119005,81151535,81184086,81216712,81249239,81281905,81314559,81347233,81379787,81412273,81444878,81477428,81509910,81542575,81575074,81607758,81640409,81672939,81705559,81738198,81770876,81803662,81836067,81868591,81901203,81933748,81966300,81998869,82031480,82064172,82096744,82129413,82162021,82194538,82227242,82259764,82292384,82325106,82357805,82390347,82422769,82455468,82487934,82520772,82553311,82585914,82618438,82651163,82683675,82716337,82748840,82781407,82814107,82846684,82879388,82911934,82944597,82977219,83009924,83042487,83075053,83107807,83140241,83172879,83205630,83237987,83270727,83303397,83335976,83368654,83401341,83433935,83466472,83499128,83531756,83564213,83596985,83629777,83662265,83694929,83727665,83760298,83792891,83825621,83858221,83890825,83923389,83955949,83988511,84021188,84053882,84086564,84119134,84151849,84184439,84216996,84249689,84282355,84314905,84347525,84380142,84412831,84445427,84478066,84510694,84543312,84576055,84608672,84641560,84674091,84706851,84739379,84772082,84804742,84837377,84869962,84902668,84935170,84967838,85000514,85033143,85065764,85098326,85131028,85163734,85196155,85228868,85261456,85294205,85326713,85359227,85392079,85424819,85457633,85490216,85522708,85555390,85588099,85620705,85653224,85686007,85718703,85751219,85783910,85816786,85849231,85882003,85914553,85947279,85979963,86012904,86045457,86078245,86110914,86143556,86176106,86208840,86241480,86274129,86306728,86339436,86372052,86404667,86437451,86470196,86502862,86535567,86568267,86600813,86633542,86666067,86698859,86731540,86764212,86797030,86829656,86862270,86895067,86927678,86960358,86993192,87025755,87058397,87091054,87123563,87156341,87189115,87221839,87254424,87287080,87319856,87352535,87385127,87417889,87450629,87483173,87515957,87548546,87581236,87613990,87646839,87679447,87711988,87744534,87777496,87810258,87843020,87875551,87908280,87940868,87973715,88006325,88039153,88071822,88104540,88137163,88169980,88202712,88235556,88268205,88300737,88333598,88366358,88399037,88431761,88464489,88497124,88529861,88562541,88595232,88627976,88660664,88693462,88726224,88758845,88791531,88824447,88857145,88889613,88922519,88955190,88987994,89020701,89053425,89086249,89118966,89151714,89184310,89217211,89249915,89282675,89315482,89348220,89380939,89413535,89446540,89479270,89512060,89544789,89577158,89609916,89642712,89675508,89708280,89741033,89773725,89806378,89839021,89871733,89904613,89937545,89970158,90002995,90035605,90068342,90101058,90133832,90166531,90199315,90232076,90265001,90297731,90330453,90363375,90396022,90428755,90461429,90494232,90526850,90559578,90592458,90625068,90657926,90690463,90723175,90755939,90788713,90821568,90854355,90887073,90919720,90952408,90985186,91018027,91050687,91083575,91116464,91149056,91181880,91214729,91247613,91280290,91312962,91345615,91378549,91411223,91444047,91476823,91509573,91542333,91575191,91607923,91640638,91673338,91706002,91739048,91771773,91804633,91837271,91870096,91902720,91935577,91968334,92001162,92033926,92066715,92099475,92132240,92165084,92197885,92230763,92263605,92296344,92329018,92361783,92394618,92427186,92460076,92492844,92525566,92558423,92591109,92623976,92656750,92689604,92722349,92755187,92787931,92820854,92853426,92886212,92919133,92951979,92984639,93017555,93050394,93083110,93115872,93148811,93181599,93214538,93247077,93279881,93312749,93345463,93378368,93411027,93443903,93476675,93509503,93542357,93575092,93608006,93640717,93673562,93706288,93739300,93771834,93804801,93837590,93870210,93902983,93936003,93968691,94001660,94034228,94067213,94099991,94132727,94165633,94198387,94231028,94263927,94296833,94329754,94362420,94395062,94428024,94460914,94493489,94526547,94559312,94592140,94624976,94657871,94690603,94723454,94756215,94789099,94821969,94854901,94887654,94920480,94953374,94986109,95018979,95051711,95084620,95117418,95150299,95183167,95215992,95248804,95281560,95314431,95347371,95380251,95413019,95445803,95478699,95511636,95544452,95577291,95609955,95642969,95675639,95708535,95741380,95774206,95807051,95839850,95872702,95905396,95938420,95971199,96004040,96036806,96069645,96102551,96135427,96168204,96201046,96233861,96266743,96299344,96332220,96365204,96398242,96430980,96463754,96496565,96529433,96562331,96595261,96627999,96660842,96693692,96726629,96759409,96792035,96825035,96858009,96890963,96923747,96956544,96989362,97022186,97055259,97088049,97120888,97153893,97186497,97219399,97252245,97285142,97318027,97350701,97383633,97416539,97449495,97482364,97515260,97548145,97581143,97613882,97646782,97679610,97712531,97745467,97778146,97810971,97844081,97876887,97909765,97942776,97975605,98008551,98041216,98074128,98106886,98139811,98172467,98205699,98238525,98271311,98304185,98337113,98370063,98402961,98435764,98468581,98501623,98534543,98567419,98600325,98633144,98666202,98699271,98732079,98764807,98797597,98830608,98863524,98896326,98929405,98962223,98995065,99027828,99060680,99093553,99126411,99159424,99192298,99225202,99258109,99291077,99323882,99356848,99389590,99422466,99455432,99488292,99521195,99554081,99586943,99619917,99652929,99685725,99718592,99751643,99784605,99817346,99850350,99883290,99916089,99949033,99981928,100014874,100047763,100080691,100113581,100146482,100179354,100212281,100245364,100278166,100311060,100343928,100376662,100409810,100442681,100475690,100508560,100541328,100574306,100607299,100640076,100673130,100705973,100738817,100771925,100804906,100837638,100870582,100903468,100936461,100969299,101002269,101035182,101068152,101101109,101133903,101166882,101199688,101232516,101265689,101298485,101331528,101364404,101397350,101430234,101463144,101496065,101528960,101561798,101594893,101627997,101660677,101693753,101726638,101759561,101792363,101825386,101858282,101891294,101924053,101957069,101989980,102022950,102055939,102088941,102121877,102154894,102187902,102220886,102253780,102286811,102319659,102352739,102385667,102418465,102451418,102484282,102517223,102550221,102583037,102615982,102649016,102681925,102714828,102747882,102780790,102813710,102846679,102879589,102912637,102945540,102978674,103011690,103044654,103077477,103110416,103143246,103176263,103209213,103242109,103275047,103308056,103341039,103374091,103407001,103439855,103472779,103505700,103538690,103571813,103604687,103637694,103670732,103703602,103736465,103769391,103802335,103835451,103868394,103901520,103934368,103967135,104000219,104033244,104066272,104099235,104132163,104165143,104198012,104231096,104263847,104296869,104329726,104362778,104395798,104428740,104461674,104494599,104527630,104560624,104593472,104626486,104659539,104692497,104725346,104758271,104791479,104824415,104857317,104890326,104923360,104956268,104989342,105022298,105055258,105088208,105121047,105154212,105187076,105220260,105253312,105286286,105319238,105352193,105385250,105418316,105451192,105484282,105517064,105550040,105583025,105616092,105649070,105682129,105715167,105747959,105781129,105814146,105847251,105880171,105913241,105946153,105979007,106012095,106045102,106078265,106111273,106143918,106176844,106209966,106243085,106276073,106308916,106342126,106375271,106408209,106441191,106474091,106507249,106540052,106572944,106605989,106639079,106672067,106705112,106738118,106771089,106804155,106837062,106870138,106902980,106935927,106969129,107002203,107035325,107068304,107101238,107134238,107167325,107200349,107233308,107266258,107299113,107332343,107365381,107398212,107431418,107464387,107497445,107530553,107563617,107596455,107629598,107662578,107695695,107728525,107761770,107794886,107827698,107860783,107893795,107926688,107959772,107992755,108025879,108058841,108091905,108124983,108157906,108191016,108223919,108256851,108289957,108323074,108356060,108389053,108422119,108455186,108488120,108521190,108554280,108587304,108620525,108653415,108686462,108719422,108752548,108785442,108818597,108851578,108884570,108917509,108950883,108983819,109016867,109049798,109082944,109115952,109148947,109182045,109214949,109247937,109280990,109314109,109347195,109380310,109413244,109446410,109479324,109512383,109545393,109578503,109611559,109644609,109677671,109710747,109743778,109776904,109809937,109843044,109876064,109909130,109942148,109975175,110008387,110041350,110074417,110107509,110140521,110173647,110206776,110240000,110272789,110305850,110338878,110371966,110405192,110438067,110471105,110504266,110537312,110570265,110603439,110636615,110669665,110702683,110735734,110768922,110802058,110835130,110868126,110901305,110934241,110967334,111000470,111033364,111066472,111099496,111132667,111165547,111198847,111231929,111264946,111298120,111331148,111364323,111397297,111430340,111463528,111496443,111529423,111562721,111595747,111628946,111661913,111694913,111728059,111760913,111794005,111827093,111860134,111893085,111926275,111959358,111992538,112025592,112058664,112091732,112124820,112157961,112190918,112224082,112257338,112290388,112323389,112356537,112389532,112422538,112455759,112488755,112521811,112554956,112588142,112621093,112654201,112687262,112720386,112753566,112786828,112819934,112853027,112885969,112919218,112952298,112985358,113018301,113051475,113084560,113117882,113150993,113184025,113216921,113250127,113283272,113316474,113349524,113382615,113415785,113448833,113481993,113515210,113548060,113581198,113614095,113647535,113680589,113713629,113746772,113779812,113812871,113846007,113879109,113912089,113945347,113978689,114011635,114044846,114077962,114111013,114144091,114177153,114210194,114243522,114276673,114309595,114342730,114375796,114409022,114442092,114475221,114508378,114541736,114574723,114607749,114640767,114674103,114707150,114740318,114773473,114806496,114839508,114872540,114905658,114938906,114972042,115005109,115038257,115071454,115104620,115137792,115171029,115204135,115237169,115270213,115303382,115336502,115369640,115402718,115435847,115468997,115502161,115535414,115568498,115601540,115634870,115667831,115701093,115734130,115767361,115800543,115833665,115866647,115899890,115932856,115965955,115999107,116032267,116065575,116098611,116131540,116164784,116197935,116231191,116264342,116297422,116330732,116363946,116397113,116430102,116463272,116496636,116529580,116562830,116596002,116629063,116662247,116695530,116728545,116761607,116794833,116827989,116861076,116894188,116927397,116960411,116993645,117026747,117059917,117093095,117126235,117159376,117192536,117225551,117258889,117292005,117325259,117358402,117391482,117424639,117457716,117490962,117524206,117557306,117590559,117623641,117656747,117690021,117723160,117756422,117789454,117822587,117855809,117888854,117922176,117955351,117988487,118021839,118054839,118087810,118121045,118154271,118187333,118220651,118253753,118286943,118320152,118353144,118386363,118419537,118452688,118486094,118519144,118552287,118585533,118618756,118651688,118684911,118718293,118751353,118784557,118817770,118850755,118884125,118917295,118950333,118983497,119016743,119049836,119082956,119116301,119149553,119182730,119215916,119249064,119282330,119315336,119348572,119381722,119414803,119448081,119481275,119514391,119547740,119580776,119614109,119647234,119680412,119713684,119746874,119780009,119813315,119846295,119879481,119912558,119946022,119979102,120012262,120045668,120078773,120111931,120145226,120178256,120211426,120244700,120277627,120311053,120344236,120377494,120410734,120443698,120476932,120510085,120543383,120576548,120609868,120643149,120676255,120709611,120742863,120776032,120809263,120842359,120875484,120908766,120941836,120975166,121008193,121041361,121074510,121107718,121141059,121174121,121207409,121240484,121273952,121306875,121340245,121373356,121406536,121439830,121472872,121506108,121539438,121572690,121605906,121639075,121672599,121705689,121738974,121772198,121805231,121838567,121871728,121904936,121937940,121971212,122004625,122037779,122070941,122104202,122137438,122170718,122203996,122237153,122270561,122303706,122337134,122370275,122403521,122436757,122469919,122503107,122536404,122569612,122602752,122636042,122669250,122702378,122735589,122769011,122802188,122835370,122868585,122901875,122935351,122968418,123001700,123034993,123068211,123101429,123134535,123167725,123201087,123234332,123267626,123300657,123334037,123367300,123400520,123433772,123467069,123500329,123533456,123566746,123600017,123633167,123666349,123699471,123732705,123766041,123799270,123832524,123865787,123898993,123932323,123965382,123998688,124031991,124065207,124098482,124131788,124165020,124198166,124231299,124264609,124298045,124331309,124364506,124397720,124430978,124464109,124497289,124530692,124563786,124597103,124630325,124663503,124696879,124729940,124763234,124796587,124829741,124862947,124896283,124929689,124962979,124996077,125029378,125062532,125095999,125129185,125162523,125195781,125228940,125262104,125295589,125328971,125362254,125395422,125428792,125462008,125495211,125528303,125561697,125594980,125628380,125661674,125694740,125727899,125761285,125794366,125827646,125860989,125894201,125927399,125960773,125994171,126027456,126060582,126093829,126127245,126160585,126193797,126226999,126260359,126293578,126326898,126360355,126393717,126426905,126460193,126493404,126526538,126559948,126593085,126626495,126659887,126693061,126726128,126759586,126792915,126826051,126859343,126892661,126926049,126959271,126992620,127025922,127059141,127092509,127125777,127159087,127192387,127225584,127259014,127292215,127325441,127358600,127391968,127425172,127458270,127491603,127524911,127558228,127591606,127624835,127658287,127691525,127724941,127758208,127791544,127824680,127857989,127891313,127924743,127957929,127991184,128024496,128057709,128090999,128124228,128157610,128190940,128224130,128257586,128290908,128324273,128357607,128390762,128424066,128457394,128490749,128523965,128557108,128590432,128623878,128657102,128690500,128723706,128757103,128790339,128823659,128856743,128890130,128923572,128956804,128990150,129023339,129056683,129090072,129123342,129156665,129190149,129223259,129256576,129289716,129323147,129356483,129389825,129423177,129456541,129489775,129523118,129556244,129589689,129623161,129656376,129689838,129723106,129756468,129789867,129823001,129856376,129889815,129923079,129956375,129989547,130022952,130056002,130089685,130122901,130156184,130189528,130222870,130256228,130289715,130323005,130356246,130389678,130422935,130456097,130489397,130522755,130556079,130589409,130622842,130656126,130689473,130722845,130756139,130789366,130822834,130856011,130889393,130922742,130956204,130989604,131022854,131056073,131089349,131122745,131156047,131189310,131222554,131255922,131289414,131322717,131356097,131389430,131422850,131456043,131489451,131522831,131556108,131589510,131622887,131656265,131689627,131722839,131756225,131789699,131822956,131856322,131889627,131923163,131956416,131989710,132023062,132056404,132089795,132122953,132156372,132189654,132223061,132256385,132289591,132323019,132356398,132389570,132423005,132456400,132489874,132523212,132556614,132589920,132623290,132656735,132689927,132723380,132756682,132789836,132823336,132856568,132890018,132923243,132956705,132990016,133023524,133056794,133090198,133123519,133156917,133190294,133223590,133256952,133290314,133323706,133356982,133390361,133423659,133457015,133490358,133523712,133557070,133590446,133623737,133657289,133690818,133724066,133757313,133790783,133824079,133857549,133890804,133924316,133957811,133991115,134024323,134057641,134091051,134124367,134157620,134190978,134224230,134257682,134291161,134324595,134358061,134391263,134424776,134458046,134491645,134524885,134558526,134591890,134625212,134658531,134691909,134725230,134758704,134792059,134825393,134858887,134892159,134925395,134958973,134992070,135025510,135058917,135092245,135125725,135159097,135192385,135225909,135259294,135292728,135326087,135359397,135392793,135426199,135459640,135492964,135526437,135559697,135593080,135626584,135659902,135693286,135726735,135760069,135793473,135826749,135860301,135893705,135927003,135960529,135993842,136027119,136060571,136093900,136127220,136160778,136194106,136227517,136260833,136294214,136327652,136360964,136394260,136427718,136461282,136494759,136528143,136561528,136595028,136628265,136661453,136694953,136728351,136761696,136795290,136828543,136862041,136895506,136928912,136962190,136995586,137029101,137062525,137095789,137129201,137162442,137195864,137229318,137262854,137296431,137329679,137363070,137396462,137429781,137463297,137496577,137530087,137563555,137596977,137630380,137663794,137697173,137730719,137764209,137797473,137830878,137864335,137897801,137931148,137964466,137997966,138031334,138064821,138098093,138131673,138165069,138198308,138231868,138265292,138298674,138332087,138365447,138398982,138432310,138465851,138499129,138532417,138565867,138599262,138632796,138666250,138699750,138733202,138766584,138799924,138833330,138866831,138900371,138933864,138967012,139000453,139034009,139067435,139100987,139134293,139167823,139201216,139234812,139268151,139301503,139334857,139368185,139401666,139435150,139468693,139502207,139535626,139568950,139602392,139635664,139669149,139702719,139736004,139769480,139802817,139836405,139869841,139903203,139936635,139969921,140003658,140036856,140070379,140103743,140137213,140170717,140204140,140237544,140270879,140304309,140337868,140371280,140404748,140438160,140471409,140505033,140538319,140571935,140605406,140638830,140672378,140705632,140739099,140772633,140806077,140839591,140872938,140906400,140939786,140973508,141006825,141040427,141073696,141107062,141140480,141173798,141207286,141240904,141274289,141307683,141341276,141374704,141408284,141441792,141475106,141508684,141541983,141575581,141609024,141642328,141675857,141709389,141742823,141776261,141809778,141843232,141876611,141910089,141943432,141976838,142010312,142043830,142077381,142110665,142144098,142177754,142211175,142244603
};///sqrt(2e7)
void Eulerprim()
{
    for(int i=2;i<=Pr_mn;i++)
    {
        if(!vis[i])
            prim[++Pr_cnt] = i;
        for(int j=1;j<=Pr_cnt&&prim[j]*i<=Pr_mn;j++)
        {
            vis[prim[j]*i] = 1;
            if(i%prim[j]==0)
                break;
        }
    }
}
int init(int Begin,int End)
{
    int ans = 0;
    for(int i=Begin;i<=End;i++)
    {
        int ti = i;
        int cnt = 0,flag = 0;
        for(int j=1;j<Pr_cnt;j++)
        {
            if(prim[j]>ti)break;
            if(ti%prim[j]==0)
            {
                cnt++;
                int c = 0;
                while(ti%prim[j]==0)
                {
                    ti/=prim[j],c++;
                    if(c>2)
                    {
                        flag = 1;
                        break;
                    }
                }
                if(flag)
                    break;
                if(c==2)
                    cnt--;
            }
        }
        if(ti>1)
            cnt++;
        if(!flag)
            ans += 1<<cnt;
    }
    return ans;
}
int main()
{
    Eulerprim();
    int t,n;
    scanf("%d",&t);
 
    while(t--)
    {
        scanf("%d",&n);
        if(n%4472==0)
            printf("%d\n",Fx[n/4472]);
        else
            printf("%d\n",Fx[n/4472]+init(n/4472*4472+1,n));
    }
 
 
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值