省冬的第一天。
带了本子,笔,一本《算法导论》就去了。惊讶于为什么同学不带本子记笔记。
他们说:“都学过了。”,果然这才是巨神吧。
第一天:数论,讲师:zzx
前几页的课件挺水,瞎记了点笔记。后面直接就讲了两道题,我就没想出来,真的菜。
然后学了波原根,又听不太懂。
莫比乌斯反演,又听不太懂。然而我自己瞎推式子好像就能反演出来,没想法XD。
杜教筛,又听不太懂。
线性代数,zzx干脆不讲了,没想法。反正也不是数论范畴。
第一天的早晨就这么过去了,@qrc去AMC10了,没想法。
中午划水
下午毒瘤题开始做了,福一中的题面就是好看。
T1正解洲阁筛,我们都是分段打表的XD。——100
T2瞎推后就变成二维数点cdq分治了,没想法。——40
T3就是剧毒,处理表达式还要推式子算组合数,没想法。——0
【T1】
题面:计算[l,r]中所有合数的最大真因数之和,对于一个合数,其最大真因数为它的正因数中除了它本身最大的一个。
题解:洲阁筛都没听懂。我的做法是:对于\(r-l\leq 5,000,000\)的数据,可以处理\(\sqrt{r}\)中的质数,把\([l,r]\)中的数筛出来。
对于更大的数据,分段打表即可。
1 #include<cstdio>
2 #include<algorithm>
3 #include<iostream>
4 #include<cmath>
5 #include<cstring>
6 using namespace std;
7 long long db[1001]={0ll,4126246193160ll,12378728639758ll,20631171412037ll,28883635629265ll,37136106727534ll,45388534571542ll,53641029590780ll,61893450343725ll,70145939882670ll,78398314522564ll,86650906615396ll,94903251693489ll,103155721252391ll,111408151342220ll,119660677157336ll,127913087049852ll,136165567668553ll,144417970434463ll,152670398028287ll,160922963597770ll,169175312295969ll,177427680650599ll,185680460766117ll,193932650163658ll,202185176961496ll,210437541301111ll,218690115627072ll,226942486289180ll,235194942080358ll,243447495675021ll,251699799516949ll,259952394940665ll,268204695273212ll,276457252222829ll,284709622036265ll,292962015904071ll,301214665538349ll,309467086512465ll,317719457852396ll,325971946736178ll,334224451664188ll,342476792512463ll,350729348954642ll,358981705820952ll,367234133799499ll,375486666486722ll,383739264009402ll,391991117300691ll,400244011032328ll,408496574863862ll,416748807652817ll,425001435374479ll,433253880717281ll,441506236356385ll,449758526618126ll,458011169792727ll,466263743492592ll,474515781733944ll,482768535461101ll,491021202744901ll,499273194350303ll,507525966605171ll,515778154479056ll,524030722845805ll,532283516302184ll,540535501723841ll,548788043558658ll,557040717591692ll,565292937838426ll,573545603889411ll,581797717040707ll,590050362090575ll,598302979698892ll,606555124683247ll,614807927249441ll,623059608785879ll,631312600962465ll,639565241647958ll,647817472963535ll,656070199278377ll,664322088355244ll,672575067134735ll,680827284961412ll,689079890210004ll,697332008730881ll,705584639010052ll,713837712288471ll,722089316408170ll,730341725563046ll,738594505418893ll,746846835981219ll,755099583270599ll,763351864888613ll,771603710033399ll,779856976763962ll,788109207052402ll,796361174622565ll,804614420822359ll,812866591976123ll,821118851080778ll,829372204248270ll,837623474425889ll,845876927637946ll,854128436542735ll,862381009647939ll,870633753994368ll,878886439323054ll,887138401182421ll,895391028877154ll,903643602429997ll,911895426257868ll,920148576694384ll,928400863241610ll,936653167437912ll,944905350159692ll,953158718292359ll,961410349110812ll,969663171666091ll,977915396915438ll,986168202061453ll,994419463152938ll,1002673635435969ll,1010924920684017ll,1019178082375547ll,1027430133354405ll,1035682568863422ll,1043934760662113ll,1052187976648438ll,1060440793106895ll,1068692261743516ll,1076944900567338ll,1085197297761257ll,1093449721607556ll,1101702394376349ll,1109954235112313ll,1118207029673161ll,1126460508129417ll,1134712036579317ll,1142964370246743ll,1151217008530707ll,1159469475456289ll,1167721757923135ll,1175974090868977ll,1184227282851390ll,1192478706186883ll,1200732563131593ll,1208984180940840ll,1217236305634235ll,1225488947632331ll,1233741871517893ll,1241993958571201ll,1250246088181101ll,1258499194833254ll,1266751869692086ll,1275003341569934ll,1283256504415517ll,1291508484922880ll,1299760151731961ll,1308014221805983ll,1316265856124619ll,1324518483557648ll,1332770251302124ll,1341022911721461ll,1349276565829502ll,1357528406229662ll,1365779744761484ll,1374033915528551ll,1382285388655225ll,1390537540980637ll,1398791249871999ll,1407042240544114ll,1415296385539158ll,1423547429013263ll,1431800462368597ll,1440052337629769ll,1448305632012050ll,1456558276107036ll,1464809655951319ll,1473062914412690ll,1481314756967827ll,1489567362230863ll,1497820324948255ll,1506070964389182ll,1514324955290500ll,1522577865690641ll,1530830106935135ll,1539081694793857ll,1547335918438050ll,1555586420051109ll,1563839820474230ll,1572092368606447ll,1580344034678732ll,1588595860213855ll,1596850670612261ll,1605100106681656ll,1613354897926284ll,1621607310143153ll,1629859232761564ll,1638111057078298ll,1646363045338683ll,1654617259483886ll,1662868196559047ll,1671120919901352ll,1679373915658212ll,1687625643310699ll,1695879680251068ll,1704130712168994ll,1712383981938390ll,1720635847170218ll,1728888769219544ll,1737141308617387ll,1745393827514876ll,1753645829064356ll,1761898237936909ll,1770149877526034ll,1778403083075087ll,1786656187825069ll,1794907216427108ll,1803160869233978ll,1811412861084890ll,1819665697313207ll,1827917581067464ll,1836170352615014ll,1844422872364856ll,1852675227343068ll,1860927821683761ll,1869181407009959ll,1877433105952955ll,1885685435450589ll,1893938202260706ll,1902188139115598ll,1910443306681314ll,1918694955467222ll,1926947711739837ll,1935197857656708ll,1943453131796200ll,1951705160391135ll,1959956495848252ll,1968209847055867ll,1976461969711557ll,1984715635835030ll,1992966124436530ll,2001219663785650ll,2009471480847824ll,2017725104191343ll,2025977283904286ll,2034228228313111ll,2042481800056284ll,2050733629245479ll,2058986717014352ll,2067239201164281ll,2075491149005751ll,2083742724373623ll,2091997048458561ll,2100248931002962ll,2108501755892471ll,2116754135888405ll,2125005595567988ll,2133257441387098ll,2141512200368743ll,2149762870497800ll,2158015001725590ll,2166270167126305ll,2174519725845254ll,2182774082798822ll,2191025083937208ll,2199278134597698ll,2207531378356192ll,2215782665731750ll,2224034866970548ll,2232287529331023ll,2240541777780767ll,2248790658347194ll,2257045984980081ll,2265298598456865ll,2273550020373621ll,2281802714042583ll,2290055083002437ll,2298306169151238ll,2306561731004904ll,2314812817512349ll,2323065690981348ll,2331315364934695ll,2339571431699355ll,2347821791748916ll,2356074961017660ll,2364326904764672ll,2372580070281120ll,2380830838425313ll,2389086187722516ll,2397336977397341ll,2405589113210539ll,2413841641652242ll,2422096106926725ll,2430345845885611ll,2438598211406487ll,2446851190644917ll,2455104197702870ll,2463355847173999ll,2471608956552202ll,2479861328799484ll,2488114725555395ll,2496365795717479ll,2504619346864744ll,2512870942260390ll,2521123827009031ll,2529376442907829ll,2537628076790470ll,2545880651216727ll,2554134824164497ll,2562385843219303ll,2570637680306174ll,2578891743596679ll,2587143805083959ll,2595396771938871ll,2603647330263169ll,2611901162154061ll,2620152607355913ll,2628405271530396ll,2636658705189102ll,2644910159364180ll,2653161097628552ll,2661417352150409ll,2669668680155701ll,2677919047757929ll,2686173962128975ll,2694423901936113ll,2702677384654151ll,2710931402419704ll,2719180961356208ll,2727437198491801ll,2735688159732884ll,2743938560734532ll,2752191761157047ll,2760445500330152ll,2768697722003280ll,2776949080456953ll,2785202186480074ll,2793454995947942ll,2801706920159967ll,2809958667660044ll,2818212288270407ll,2826464105305695ll,2834716830009522ll,2842968346431169ll,2851223117209708ll,2859474865661328ll,2867726001876589ll,2875980642747090ll,2884229439265929ll,2892485296796488ll,2900735647772762ll,2908990075928416ll,2917241190823227ll,2925493917128939ll,2933746130760822ll,2941997615382457ll,2950251046025549ll,2958504165936910ll,2966755565778810ll,2975008295551923ll,2983260228872575ll,2991513982840406ll,2999766319392187ll,3008017181921323ll,3016273376889765ll,3024521499662162ll,3032775913878930ll,3041027942524243ll,3049280825052736ll,3057533413819963ll,3065786326481569ll,3074037245466723ll,3082289463597926ll,3090544175363390ll,3098793356187296ll,3107050080366003ll,3115300585865975ll,3123551494602499ll,3131805229163926ll,3140055693810208ll,3148311912014555ll,3156562718240183ll,3164814508688857ll,3173068026750489ll,3181319821977095ll,3189572530168994ll,3197823945837887ll,3206078039894298ll,3214328255124715ll,3222581084326855ll,3230837277567491ll,3239086940284289ll,3247338339522627ll,3255590861769794ll,3263844071347975ll,3272095742840731ll,3280351794222680ll,3288600187270777ll,3296855101030879ll,3305106732435792ll,3313358838877316ll,3321609478416381ll,3329863741114340ll,3338118017610359ll,3346369579999256ll,3354618268876799ll,3362875003236037ll,3371124766735525ll,3379379131186447ll,3387630185746211ll,3395884185073377ll,3404136571076753ll,3412388208110334ll,3420640759671914ll,3428893081553050ll,3437144665606191ll,3445398534916775ll,3453651967361451ll,3461903599686551ll,3470151645249035ll,3478411531209438ll,3486657674985036ll,3494911760900681ll,3503167301426935ll,3511419820519635ll,3519670280851579ll,3527922907716281ll,3536175956334171ll,3544427218232422ll,3552678692429904ll,3560933574552396ll,3569185407516411ll,3577436984311315ll,3585687121017890ll,3593944211615305ll,3602194945359195ll,3610447684034185ll,3618698899000597ll,3626953566197827ll,3635203144855753ll,3643458359026990ll,3651710787511210ll,3659960442631978ll,3668213778093901ll,3676467282458260ll,3684720013115923ll,3692971943730382ll,3701224319428737ll,3709474046014293ll,3717727830441720ll,3725986030793314ll,3734230263576533ll,3742486533281976ll,3750737459936037ll,3758992261189390ll,3767243145817809ll,3775495493074221ll,3783748018080245ll,3791999710195498ll,3800255057787662ll,3808505965568630ll,3816755962419611ll,3825013670562066ll,3833263570884925ll,3841516176820074ll,3849768247889225ll,3858020207678925ll,3866275753963201ll,3874525283257184ll,3882776423413622ll,3891029351931232ll,3899284867808382ll,3907536125048951ll,3915788901889101ll,3924039009777036ll,3932290833033464ll,3940545304020242ll,3948801860322982ll,3957046187721652ll,3965304733421226ll,3973554335216274ll,3981807117966089ll,3990060750267243ll,3998314460692582ll,4006560671488589ll,4014818231242852ll,4023071192200276ll,4031323017039280ll,4039573093193550ll,4047825255044345ll,4056080829555106ll,4064333445879854ll,4072585531782464ll,4080833873396170ll,4089091894128706ll,4097339447670076ll,4105594737376001ll,4113845113269680ll,4122100958768381ll,4130349716036392ll,4138604645600883ll,4146858875667187ll,4155108634922538ll,4163358989129136ll,4171615654775226ll,4179864221592264ll,4188118335870568ll,4196372031635332ll,4204622781909687ll,4212875778823105ll,4221129111264738ll,4229380093156833ll,4237633483561950ll,4245884624779001ll,4254136039199650ll,4262392639421847ll,4270645240285504ll,4278895213798486ll,4287148555171525ll,4295400082017421ll,4303653849433572ll,4311904371059075ll,4320158627329533ll,4328408885659026ll,4336663211549554ll,4344917177993784ll,4353168513967272ll,4361421317405677ll,4369672448665840ll,4377922613690984ll,4386178632133923ll,4394429821218815ll,4402682845669681ll,4410932045929304ll,4419189403338844ll,4427439599770921ll,4435692124669981ll,4443946522514183ll,4452196587319287ll,4460447153426211ll,4468705524093101ll,4476954181084895ll,4485206616541896ll,4493457877867992ll,4501712440750199ll,4509966093000512ll,4518216506891885ll,4526468925225636ll,4534721059237123ll,4542975579161994ll,4551226795053220ll,4559478991861728ll,4567730994677183ll,4575983234574448ll,4584235374889421ll,4592489738610728ll,4600740266178086ll,4608994265114010ll,4617245053650908ll,4625500717375617ll,4633748360643935ll,4642002933017796ll,4650255844494153ll,4658508096927840ll,4666761375547773ll,4675012263067416ll,4683266095603251ll,4691521004668729ll,4699769084549337ll,4708020526467684ll,4716277951464806ll,4724525356564207ll,4732781612707648ll,4741032880704836ll,4749286176188914ll,4757538892784039ll,4765789307656539ll,4774043033174736ll,4782295053138499ll,4790547038841279ll,4798798277165948ll,4807050651303544ll,4815306969070132ll,4823559674137575ll,4831809222903867ll,4840061553191787ll,4848313873538669ll,4856568456018401ll,4864820368485566ll,4873071271599686ll,4881326656599298ll,4889574106182860ll,4897828348489435ll,4906084894092353ll,4914333979722197ll,4922586029481820ll,4930841251272688ll,4939091122861998ll,4947343865010627ll,4955593762249549ll,4963851374956602ll,4972101430778074ll,4980356617120612ll,4988605472991551ll,4996859300719623ll,5005110950089551ll,5013366272410924ll,5021612591511858ll,5029868130439516ll,5038123202765017ll,5046375221972283ll,5054623203943886ll,5062879831936568ll,5071127894977068ll,5079383388402940ll,5087638427339662ll,5095887087656285ll,5104139219182680ll,5112394000517895ll,5120647030784142ll,5128898084678534ll,5137150402274426ll,5145405017821747ll,5153651932590512ll,5161909049716145ll,5170164124810685ll,5178409266375282ll,5186665883448277ll,5194917706183003ll,5203168195571922ll,5211422535889657ll,5219678304065660ll,5227924652110881ll,5236182924879430ll,5244427838140794ll,5252686230736253ll,5260933446056267ll,5269189861397709ll,5277444344529586ll,5285694171177002ll,5293945628073748ll,5302200401096075ll,5310455705831528ll,5318699675434409ll,5326958615514079ll,5335210297462303ll,5343463534496012ll,5351712082540394ll,5359968777766584ll,5368215565581855ll,5376472535549718ll,5384728611656937ll,5392974363218411ll,5401227570782007ll,5409485601461581ll,5417731750067066ll,5425986267734462ll,5434239074781473ll,5442488923218258ll,5450744086966550ll,5458998889389518ll,5467248638660167ll,5475496914177482ll,5483755422447857ll,5492004339489281ll,5500255884432981ll,5508512951046708ll,5516764998806126ll,5525015045632539ll,5533270980896929ll,5541521576351934ll,5549770963039480ll,5558026750548537ll,5566277558132396ll,5574528013657487ll,5582784523800746ll,5591031947469177ll,5599292632015776ll,5607541140214280ll,5615789099754928ll,5624042497439130ll,5632300302823064ll,5640548217180715ll,5648803982957420ll,5657056003627456ll,5665305077660600ll,5673556165459395ll,5681815417972322ll,5690061491829913ll,5698319588106770ll,5706572156975665ll,5714819498651897ll,5723072813114938ll,5731329338381847ll,5739578823419933ll,5747829614334653ll,5756085004354851ll,5764336282944942ll,5772590605617758ll,5780839158537564ll,5789091823427477ll,5797347276534064ll,5805601470594884ll,5813848885349429ll,5822104960113992ll,5830353571547651ll,5838610465535497ll,5846861312526612ll,5855113623773091ll,5863365156848187ll,5871618565545585ll,5879873004314040ll,5888126917716649ll,5896372908100239ll,5904629644635474ll,5912883289621822ll,5921129467378451ll,5929387216285172ll,5937637675491927ll,5945890500817572ll,5954143538519239ll,5962396442363892ll,5970648401446912ll,5978898227856883ll,5987155268828423ll,5995404961153194ll,6003654727692311ll,6011906886897873ll,6020166226085924ll,6028413105831074ll,6036666571813983ll,6044920969838969ll,6053172891426176ll,6061424084184666ll,6069675162136651ll,6077934276966594ll,6086181836672854ll,6094438566042231ll,6102685082610800ll,6110939135288748ll,6119191071540472ll,6127444900452135ll,6135695402899421ll,6143947383269049ll,6152202292015254ll,6160457524289004ll,6168709021820804ll,6176953770015863ll,6185210225162499ll,6193462103998242ll,6201721417504669ll,6209968441531394ll,6218222584076174ll,6226473518437889ll,6234724450986511ll,6242979165522463ll,6251231794987889ll,6259485663139794ll,6267737986678539ll,6275986360420790ll,6284240385704516ll,6292493831905101ll,6300743643053655ll,6308998224165984ll,6317252218019157ll,6325502004309904ll,6333753482286491ll,6342008874879601ll,6350260170447059ll,6358515626542934ll,6366765296724798ll,6375022442187828ll,6383265429991092ll,6391523961223505ll,6399776682559935ll,6408027333463195ll,6416278739223222ll,6424539559816842ll,6432778918894588ll,6441039011354239ll,6449289439301017ll,6457544447970078ll,6465798128909762ll,6474047228863189ll,6482299292746479ll,6490552887117242ll,6498802108265034ll,6507057978954221ll,6515310157081339ll,6523563131048348ll,6531812264509276ll,6540067528248903ll,6548319658836561ll,6556570874249643ll,6564821175483977ll,6573081418472554ll,6581333115221803ll,6589579439588766ll,6597834824506338ll,6606083064324884ll,6614339526281843ll,6622597513181267ll,6630836635393075ll,6639099482805580ll,6647350450478108ll,6655603607800850ll,6663849823207608ll,6672106851372059ll,6680360937732904ll,6688607697105081ll,6696865016533754ll,6705117106721407ll,6713367402094191ll,6721624083899389ll,6729872622938087ll,6738122787065790ll,6746382851526592ll,6754630624237557ll,6762884948000277ll,6771137156065200ll,6779384687986064ll,6787641598489658ll,6795892562013620ll,6804141307711215ll,6812402975668927ll,6820644402604050ll,6828904689395772ll,6837157066430693ll,6845410176071217ll,6853658312239207ll,6861912851883538ll,6870166887673232ll,6878418852766272ll,6886666064788549ll,6894927310457310ll,6903175013655245ll,6911420988380029ll,6919685885895149ll,6927930137610693ll,6936183841821810ll,6944440867682952ll,6952684334947450ll,6960939293511696ll,6969197357239842ll,6977448584288780ll,6985699505503416ll,6993954645411518ll,7002203082009207ll,7010453855644442ll,7018709318547936ll,7026960407016206ll,7035217927611865ll,7043466419037300ll,7051719427417281ll,7059966536615330ll,7068228797995147ll,7076471989708885ll,7084730852071606ll,7092978395293010ll,7101231938643095ll,7109486977603916ll,7117744828960168ll,7125989323962864ll,7134240013521474ll,7142496932289252ll,7150744626501259ll,7159000214046991ll,7167254393506188ll,7175506144671609ll,7183759413599110ll,7192008701930204ll,7200260129579064ll,7208517514046550ll,7216769489140625ll,7225014978232798ll,7233271154130501ll,7241529364083236ll,7249777411172574ll,7258029298497640ll,7266287105155387ll,7274535503716788ll,7282786739567212ll,7291038180179142ll,7299292435136628ll,7307546937789671ll,7315796838776594ll,7324053003643892ll,7332305970713796ll,7340552287123121ll,7348804754649584ll,7357057570825706ll,7365315855028632ll,7373565153334962ll,7381813915105376ll,7390071245066023ll,7398322950338870ll,7406573783636134ll,7414828891602267ll,7423077573276426ll,7431329629774319ll,7439586625813374ll,7447833320907149ll,7456084338574506ll,7464348653284835ll,7472598982748900ll,7480842189080237ll,7489098505612442ll,7497347755961998ll,7505603433642677ll,7513859688553926ll,7522107918315630ll,7530358319887666ll,7538610435162381ll,7546871107586580ll,7555118524215395ll,7563372351358735ll,7571622303721121ll,7579871036159131ll,7588133999963564ll,7596383249386616ll,7604626737199583ll,7612891787764363ll,7621137023828605ll,7629384973424964ll,7637646286762868ll,7645898146282521ll,7654147355711203ll,7662393200254094ll,7670656138283468ll,7678904160136127ll,7687158481216871ll,7695412717696013ll,7703660933660557ll,7711914575612208ll,7720167737473709ll,7728416925310084ll,7736672148549850ll,7744925462336070ll,7753172855758582ll,7761434677625269ll,7769683995902167ll,7777933859410497ll,7786185222549176ll,7794441380416444ll,7802689623315417ll,7810945026449234ll,7819191051776533ll,7827451586781376ll,7835703520256323ll,7843949357504304ll,7852211389178157ll,7860460171903986ll,7868708784182509ll,7876966001612754ll,7885217827997875ll,7893469377340151ll,7901713111346610ll,7909980586212708ll,7918229848967808ll,7926475725616806ll,7934732425834514ll,7942975827545192ll,7951237923355540ll,7959497414687351ll,7967738738895736ll,7975988621863044ll,7984247248180536ll,7992499095559087ll,8000748061706199ll,8009005365389683ll,8017254279468093ll,8025508035004150ll,8033762318558178ll,8042010797225973ll,8050263937530394ll,8058519617851198ll,8066772572056332ll,8075020103588341ll,8083280498765985ll,8091523112748816ll,8099777069138991ll,8108041966885339ll,8116282552165392ll,8124534952802314ll,8132795963680539ll,8141034628392631ll,8149296427897892ll,8157545519899955ll,8165800317750035ll,8174049687323585ll,8182301934425911ll,8190558479023990ll,8198816455233635ll,8207059653642486ll,8215313533705195ll,8223567434586417ll,8231823535766866ll,8240069684329272ll,8248333472646903ll};
8 long long l,r;
9 int c;
10 long long ans;
11 bool com[100001]={1,1};
12 int pri[100001],tot;
13 int com2[10000001];
14 void init(){
15 long long sq=sqrt(r);
16 while((sq+1)*(sq+1)<=r) sq++;
17 while((sq-1)*(sq-1)>=r) sq--;
18 if(sq*sq>r) sq--;
19 int Sq=sq;
20 for(int i=2;i<=Sq;++i){
21 if(!com[i]) pri[++tot]=i;
22 for(int j=1;j<=tot&&i*pri[j]<=Sq;++j){
23 com[i*pri[j]]=true;
24 if(i%pri[j]==0) break;
25 }
26 }
27 }
28 int main(){
29 freopen("factor.in","r",stdin);
30 freopen("factor.out","w",stdout);
31 cin>>l>>r;
32 init();
33 if(r-l<=6000000){
34 c=r-l;
35 for(int i=tot;i>=1;--i){
36 for(long long j=max((l-1)/pri[i]+1,2ll)*pri[i];j<=r;j+=pri[i]){
37 com2[j-l+1]=pri[i];
38 }
39 }
40 for(int i=1;i<=c+1;++i){
41 if(com2[i]) ans+=(i+l-1)/com2[i];
42 }
43 cout<<ans;
44 return 0;
45 }
46 long long L=l,R=r;
47 l=L, r=((L-1)/5000000+1)*5000000;
48 c=r-l;
49 for(int i=tot;i>=1;--i){
50 for(long long j=max((l-1)/pri[i]+1,2ll)*pri[i];j<=r;j+=pri[i]){
51 com2[j-l+1]=pri[i];
52 }
53 }
54 for(int i=1;i<=c+1;++i){
55 if(com2[i]) ans+=(i+l-1)/com2[i];
56 }
57 //===========
58 int l1=r/5000000+1;
59 //===========
60 r=R, l=(R-1)/5000000*5000000+1;
61 c=r-l;
62 memset(com2,0,sizeof com2);
63 for(int i=tot;i>=1;--i){
64 for(long long j=max((l-1)/pri[i]+1,2ll)*pri[i];j<=r;j+=pri[i]){
65 com2[j-l+1]=pri[i];
66 }
67 }
68 for(int i=1;i<=c+1;++i){
69 if(com2[i]) ans+=(i+l-1)/com2[i];
70 }
71 //===========
72 int r1=(l-1)/5000000;
73 for(int i=l1;i<=r1;++i) ans+=db[i];
74 cout<<ans;
75 return 0;
76 }