Problem:


Score : 300 points

Problem Statement

You are given an integer N.
Find the number of the positive divisors of N!, modulo 10^9+7.

Constraints

1≤N≤10^3

Input

The input is given from Standard Input in the following format:

N

Output

Print the number of the positive divisors of N!, modulo 10^9+7.

Sample Input 1

3

Sample Output 1

4

There are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.

Sample Input 2

6

Sample Output 2

30

Sample Input 3

1000

Sample Output 3

972926972



Sample input:
3


Sample output:
4

Submission status: Accepted

Solution code:
l = [0,1,2,4,8,16,30,60,96,160,270,540,792,1584,2592,4032,5376,10752,14688,29376,41040,60800,96000,192000,242880,340032,532224,677376,917280,1834560,2332800,4665600,5529600,7864320,12165120,16422912,19595520,39191040,60466176,85100544,102435840,204871680,258048000,516096000,677376000,819624960,258709753,517419506,876670706,698576619,464046052,210846678,87039944,174079888,559756674,984916319,217548604,16857327,609087587,218175167,106431041,212862082,535421074,139926156,50952999,105219839,195900610,391801220,889436190,472974756,845412639,690825271,891132264,782264521,316684054,31280490,665186745,252135966,764748573,529497139,790600338,524719291,999573608,999147209,522112609,37861883,417241520,775916997,997830958,995661909,729407917,321723976,871170030,520705814,149385219,41956001,988486370,976972733,516785610,158924226,583951250,167902493,687346296,374692585,229757313,549263416,890796057,781592107,875619122,751238237,277966376,130571620,574892396,149784785,921692445,813661707,582700142,400726352,358621292,318642155,250091916,386472265,174406757,151737975,260683867,184202887,320817301,641634602,125034947,201660251,962210566,924421125,489345615,320577061,637208078,196761361,626955546,253911085,389481998,778963996,576273102,309075370,619146484,295106277,464103226,498550267,627180822,788686761,989134263,978268519,902509248,805018489,112903872,32995287,295406792,974343106,721660051,443320095,316385239,778274799,190780502,633014225,727670045,455340083,498164792,15588548,97601235,195202470,569355054,118486597,342752204,135661810,90769804,181539608,519303442,515842850,84989549,696032419,231083385,462166770,150280772,300561544,884472740,641985713,569378318,591770736,690140664,249252882,677627271,850771381,851099110,702198213,111350575,222701150,859360900,670197303,177520684,355041368,643925245,287850483,323688011,476804260,749121574,436195097,100916105,763521317,852472431,566135419,817481112,609114726,316546467,633092934,400461490,516478899,802348580,904410955,621677199,257318500,176522245,676814987,463688019,296329114,264099706,528199412,36178948,424547801,768068647,536137287,180929498,361858996,212858280,424867383,432882564,865765128,720594700,90410365,461821767,203725504,114020002,228040004,637601848,275203689,996048794,816392758,827385828,501246906,502796187,283931071,433357175,368415063,694773670,389547333,672209469,929924926,339805954,823423911,430631131,861262262,912999218,775754185,248442642,92860619,47164638,94329276,560810218,901787221,979102645,727649351,20618968,41237936,409407748,818815496,105871481,565828513,733793480,775394695,826327221,652654435,644963335,70964339,34934197,69868394,21321430,42642860,308165968,66236679,863975191,474703946,965050168,372703124,98935522,622346998,724308287,448616567,387250563,521154852,757291985,756807708,98256492,802531326,949720885,885971876,131412209,981761360,661149918,619958299,331028217,662056434,807561987,320675293,914129701,828259395,37073206,74146412,402841690,54637455,617124544,234249081,751443813,937109749,192721498,402972372,453564416,21903965,219196964,711481873,513083746,252120578,510728243,686346634,854955589,709911171,78596230,269965951,409219288,248271231,873383775,746767543,509852147,174891499,984879786,197881406,237525166,359571994,592280493,443047391,387927598,775855196,487579371,975158742,351882153,147029129,237093507,474187014,233169083,703708683,126101010,198878663,367151757,734303514,558855498,196629758,161317030,573722496,327882255,869789706,71204994,142409988,519330677,658916599,820221123,589765049,882787662,765575317,237538730,765336752,111906311,970555905,547616857,95233707,919602856,913510209,325919347,651838694,787773019,168803670,875276542,263468393,816727867,633455727,500272724,140006678,171663917,920917448,754148927,547298078,412984678,825969356,89434825,653930388,136393590,272787180,276924235,570666519,590968903,696916544,114558109,209914977,987646996,975293985,732105167,207549775,590764498,239710087,413342719,606756472,119222007,227695505,450857281,901714562,192653364,385306728,234022344,31755833,752787939,682129837,972238124,563737250,589527825,729854221,873389836,746779665,973964734,947929461,5202400,320558679,402562062,651932087,438747311,877494622,851938578,595655182,953260474,906520941,610950283,501334286,115901200,458267670,725708035,451416063,34629651,443595068,292992687,984336996,352845142,600659252,738086132,476172257,146298687,742115388,685981689,371963371,5238701,10477402,766426619,741060152,215953758,431907516,900346034,302070357,669584758,46053147,500531147,269366731,835955289,753764439,748101695,586666665,340467085,680934170,993066655,337509515,702294178,689317659,610110893,855932510,718959729,437919451,162052266,591444463,937285062,874570117,577640930,690830665,441136051,234385594,995953016,490091986,701529803,403059599,173749087,571309264,670816347,341632687,12414678,656616799,110230917,555093018,326641735,653283470,841517232,299713801,790165940,55645384,857068605,957840454,891206655,734604192,144312526,317679024,396371648,792743296,423188008,846376016,985116058,646955723,952177710,502929334,92150358,447989522,924790847,549384151,424045976,984526166,194912796,17485470,655375515,480905089,910910739,771660846,177055119,354110238,487461754,533406064,889925808,672895377,471803466,943606932,363992147,457850989,337082821,559633947,903886732,428980584,430095367,52327251,636880607,273761207,706305042,890884144,393016175,748347757,949802139,899604271,310566618,130756774,816805638,605028078,169610267,339220534,575779053,151558099,779861186,564602992,437157814,502964081,478103459,956206918,385872385,383885002,125139522,606176173,727381953,8385703,189534611,657264353,809755457,619510907,607320752,922420555,310951652,461684174,548921957,97843907,729671781,620980721,857109915,25052446,275170024,550340048,495401987,990803974,362448559,60904426,929227965,120741193,257409647,514819294,969108899,560048584,985073824,700527244,680852420,361704833,819310219,589014097,1398831,2797662,533149213,66298419,177289968,605590036,607911651,709970869,953992856,619456719,655319030,644362951,232480867,745680583,590594926,181189845,520817003,742434671,899661005,364907082,733053610,13738009,433804341,236387921,508481622,16963237,232316619,464633238,221314587,887788178,285824818,571649636,737224462,55447552,88454246,798654422,982084080,964168153,247453861,1833862,99268162,659694667,466104507,932209014,864422567,728845127,537854091,599199290,264178678,250863989,574407941,732405085,314042625,489474931,176295562,914244677,852693813,705387619,193242738,892738773,352048555,704097110,771025308,753975129,927527314,542054326,2994361,5988722,142029115,324378674,100232612,267369886,945624300,882384522,416443431,832886862,784668659,985124309,298874953,102595581,589967510,536599545,782218536,77865166,65277123,130554246,660510295,877005583,275946488,615306711,199915845,893431699,154588775,309177550,504746854,864753530,291783330,553114672,78102633,511352330,753667006,152737422,966787467,933574927,743434691,300957143,206901132,971318792,551792353,641951914,887092590,774185173,324319767,296313969,419748261,736668708,125202855,250405710,860306792,120041519,287948500,772974185,72505984,145011968,197340762,319569601,29058411,58116822,503961279,97170670,855412437,719283733,922189282,610817142,981054324,962108641,555626129,721425306,8695797,867937276,204728691,409457382,327387384,796008217,623487493,246974979,808073302,987531151,661621379,619686012,885900428,182865420,604993928,209987849,112149920,982821831,436804698,873609396,249429664,35442337,542946067,435717873,357909594,663354277,349837771,172902187,725024195,626724406,951883201,898886813,611894793,223789579,156249711,953762374,941520348,627312415,732152146,626637375,697801379,928373167,467201812,934403624,300174312,940164327,768557112,666818604,430052749,769678528,637336196,471510530,884736131,405930623,88523589,177047178,741193266,482386525,959636069,420122608,870743513,206500587,931686480,949884867,256838150,936095622,169293108,338586216,20108011,40216022,515421399,752804022,39087839,78175678,170102,340204,946184524,167781729,835787762,903545720,642497069,768924002,848555995,948817436,408127979,816255958,800214847,62298624,211839153,598162116,649248474,550398359,199342730,466361673,327607418,129788111,60519012,181516929,291695327,583390654,933077030,384594463,248685267,497370534,574889090,149778173,508531933,813332884,744233240,488466473,623778584,4368568,996107508,578055173,827804465,735970254,633530545,296440400,68756126,969743180,876576330,723047882,284529056,569058112,955600472,546169433,803429308,606858609,391311257,782622514,544679226,242364688,879318989,758637971,578342645,882174629,300235757,203149792,186638455,197248609,4796039,513889283,888015602,188499605,180716688,503135262,412392718,986465265,744612799,335327753,188776829,910205676,736820167,473640327,438152515,953148782,574653619,149307231,898195178,851342559,30893933,76564644,524487579,530536325,132326487,264652974,436939730,343683655,215324089,564898148,437093697,270599954,464012989,329405798,476278405,952556810,152525842,639543549,539816971,508927499,355269900,826589616,330452844,660905688,53392193,5534060,69632488,139264976,254644395,744092152,539703029,555053484,899170215,798340423,422351818,444892614,151256959,504363114,893778023,787556039,802071847,381737209,85245710,493128509,945208231,475863350,279284954,813432374,905487747,730092313,198445481,573858992,640307357,280614707,780620191,211244466,611704170,223408333,494598748,968788563,176505672,286582450,993252097,986504187,529362547,560946912,386341399,989315317,14725758,29451516,215685422,95948827,463209666,847826556,571585155,357027634,71359521,142719042,128278247,45877819,700894880,39614801,668371163,336742319,338115610,570799830,972926972]
print(l[int(input())])

Submission status: Accepted

Solution code:
n = int(input())
l = [1,2,4,8,16,30,60,96,160,270,540,792,1584,2592,4032,5376,10752,14688,29376,41040,60800,96000,192000,242880,340032,532224,677376,917280,1834560,2332800,4665600,5529600,7864320,12165120,16422912,19595520,39191040,60466176,85100544,102435840,204871680,258048000,516096000,677376000,819624960,258709753,517419506,876670706,698576619,464046052,210846678,87039944,174079888,559756674,984916319,217548604,16857327,609087587,218175167,106431041,212862082,535421074,139926156,50952999,105219839,195900610,391801220,889436190,472974756,845412639,690825271,891132264,782264521,316684054,31280490,665186745,252135966,764748573,529497139,790600338,524719291,999573608,999147209,522112609,37861883,417241520,775916997,997830958,995661909,729407917,321723976,871170030,520705814,149385219,41956001,988486370,976972733,516785610,158924226,583951250,167902493,687346296,374692585,229757313,549263416,890796057,781592107,875619122,751238237,277966376,130571620,574892396,149784785,921692445,813661707,582700142,400726352,358621292,318642155,250091916,386472265,174406757,151737975,260683867,184202887,320817301,641634602,125034947,201660251,962210566,924421125,489345615,320577061,637208078,196761361,626955546,253911085,389481998,778963996,576273102,309075370,619146484,295106277,464103226,498550267,627180822,788686761,989134263,978268519,902509248,805018489,112903872,32995287,295406792,974343106,721660051,443320095,316385239,778274799,190780502,633014225,727670045,455340083,498164792,15588548,97601235,195202470,569355054,118486597,342752204,135661810,90769804,181539608,519303442,515842850,84989549,696032419,231083385,462166770,150280772,300561544,884472740,641985713,569378318,591770736,690140664,249252882,677627271,850771381,851099110,702198213,111350575,222701150,859360900,670197303,177520684,355041368,643925245,287850483,323688011,476804260,749121574,436195097,100916105,763521317,852472431,566135419,817481112,609114726,316546467,633092934,400461490,516478899,802348580,904410955,621677199,257318500,176522245,676814987,463688019,296329114,264099706,528199412,36178948,424547801,768068647,536137287,180929498,361858996,212858280,424867383,432882564,865765128,720594700,90410365,461821767,203725504,114020002,228040004,637601848,275203689,996048794,816392758,827385828,501246906,502796187,283931071,433357175,368415063,694773670,389547333,672209469,929924926,339805954,823423911,430631131,861262262,912999218,775754185,248442642,92860619,47164638,94329276,560810218,901787221,979102645,727649351,20618968,41237936,409407748,818815496,105871481,565828513,733793480,775394695,826327221,652654435,644963335,70964339,34934197,69868394,21321430,42642860,308165968,66236679,863975191,474703946,965050168,372703124,98935522,622346998,724308287,448616567,387250563,521154852,757291985,756807708,98256492,802531326,949720885,885971876,131412209,981761360,661149918,619958299,331028217,662056434,807561987,320675293,914129701,828259395,37073206,74146412,402841690,54637455,617124544,234249081,751443813,937109749,192721498,402972372,453564416,21903965,219196964,711481873,513083746,252120578,510728243,686346634,854955589,709911171,78596230,269965951,409219288,248271231,873383775,746767543,509852147,174891499,984879786,197881406,237525166,359571994,592280493,443047391,387927598,775855196,487579371,975158742,351882153,147029129,237093507,474187014,233169083,703708683,126101010,198878663,367151757,734303514,558855498,196629758,161317030,573722496,327882255,869789706,71204994,142409988,519330677,658916599,820221123,589765049,882787662,765575317,237538730,765336752,111906311,970555905,547616857,95233707,919602856,913510209,325919347,651838694,787773019,168803670,875276542,263468393,816727867,633455727,500272724,140006678,171663917,920917448,754148927,547298078,412984678,825969356,89434825,653930388,136393590,272787180,276924235,570666519,590968903,696916544,114558109,209914977,987646996,975293985,732105167,207549775,590764498,239710087,413342719,606756472,119222007,227695505,450857281,901714562,192653364,385306728,234022344,31755833,752787939,682129837,972238124,563737250,589527825,729854221,873389836,746779665,973964734,947929461,5202400,320558679,402562062,651932087,438747311,877494622,851938578,595655182,953260474,906520941,610950283,501334286,115901200,458267670,725708035,451416063,34629651,443595068,292992687,984336996,352845142,600659252,738086132,476172257,146298687,742115388,685981689,371963371,5238701,10477402,766426619,741060152,215953758,431907516,900346034,302070357,669584758,46053147,500531147,269366731,835955289,753764439,748101695,586666665,340467085,680934170,993066655,337509515,702294178,689317659,610110893,855932510,718959729,437919451,162052266,591444463,937285062,874570117,577640930,690830665,441136051,234385594,995953016,490091986,701529803,403059599,173749087,571309264,670816347,341632687,12414678,656616799,110230917,555093018,326641735,653283470,841517232,299713801,790165940,55645384,857068605,957840454,891206655,734604192,144312526,317679024,396371648,792743296,423188008,846376016,985116058,646955723,952177710,502929334,92150358,447989522,924790847,549384151,424045976,984526166,194912796,17485470,655375515,480905089,910910739,771660846,177055119,354110238,487461754,533406064,889925808,672895377,471803466,943606932,363992147,457850989,337082821,559633947,903886732,428980584,430095367,52327251,636880607,273761207,706305042,890884144,393016175,748347757,949802139,899604271,310566618,130756774,816805638,605028078,169610267,339220534,575779053,151558099,779861186,564602992,437157814,502964081,478103459,956206918,385872385,383885002,125139522,606176173,727381953,8385703,189534611,657264353,809755457,619510907,607320752,922420555,310951652,461684174,548921957,97843907,729671781,620980721,857109915,25052446,275170024,550340048,495401987,990803974,362448559,60904426,929227965,120741193,257409647,514819294,969108899,560048584,985073824,700527244,680852420,361704833,819310219,589014097,1398831,2797662,533149213,66298419,177289968,605590036,607911651,709970869,953992856,619456719,655319030,644362951,232480867,745680583,590594926,181189845,520817003,742434671,899661005,364907082,733053610,13738009,433804341,236387921,508481622,16963237,232316619,464633238,221314587,887788178,285824818,571649636,737224462,55447552,88454246,798654422,982084080,964168153,247453861,1833862,99268162,659694667,466104507,932209014,864422567,728845127,537854091,599199290,264178678,250863989,574407941,732405085,314042625,489474931,176295562,914244677,852693813,705387619,193242738,892738773,352048555,704097110,771025308,753975129,927527314,542054326,2994361,5988722,142029115,324378674,100232612,267369886,945624300,882384522,416443431,832886862,784668659,985124309,298874953,102595581,589967510,536599545,782218536,77865166,65277123,130554246,660510295,877005583,275946488,615306711,199915845,893431699,154588775,309177550,504746854,864753530,291783330,553114672,78102633,511352330,753667006,152737422,966787467,933574927,743434691,300957143,206901132,971318792,551792353,641951914,887092590,774185173,324319767,296313969,419748261,736668708,125202855,250405710,860306792,120041519,287948500,772974185,72505984,145011968,197340762,319569601,29058411,58116822,503961279,97170670,855412437,719283733,922189282,610817142,981054324,962108641,555626129,721425306,8695797,867937276,204728691,409457382,327387384,796008217,623487493,246974979,808073302,987531151,661621379,619686012,885900428,182865420,604993928,209987849,112149920,982821831,436804698,873609396,249429664,35442337,542946067,435717873,357909594,663354277,349837771,172902187,725024195,626724406,951883201,898886813,611894793,223789579,156249711,953762374,941520348,627312415,732152146,626637375,697801379,928373167,467201812,934403624,300174312,940164327,768557112,666818604,430052749,769678528,637336196,471510530,884736131,405930623,88523589,177047178,741193266,482386525,959636069,420122608,870743513,206500587,931686480,949884867,256838150,936095622,169293108,338586216,20108011,40216022,515421399,752804022,39087839,78175678,170102,340204,946184524,167781729,835787762,903545720,642497069,768924002,848555995,948817436,408127979,816255958,800214847,62298624,211839153,598162116,649248474,550398359,199342730,466361673,327607418,129788111,60519012,181516929,291695327,583390654,933077030,384594463,248685267,497370534,574889090,149778173,508531933,813332884,744233240,488466473,623778584,4368568,996107508,578055173,827804465,735970254,633530545,296440400,68756126,969743180,876576330,723047882,284529056,569058112,955600472,546169433,803429308,606858609,391311257,782622514,544679226,242364688,879318989,758637971,578342645,882174629,300235757,203149792,186638455,197248609,4796039,513889283,888015602,188499605,180716688,503135262,412392718,986465265,744612799,335327753,188776829,910205676,736820167,473640327,438152515,953148782,574653619,149307231,898195178,851342559,30893933,76564644,524487579,530536325,132326487,264652974,436939730,343683655,215324089,564898148,437093697,270599954,464012989,329405798,476278405,952556810,152525842,639543549,539816971,508927499,355269900,826589616,330452844,660905688,53392193,5534060,69632488,139264976,254644395,744092152,539703029,555053484,899170215,798340423,422351818,444892614,151256959,504363114,893778023,787556039,802071847,381737209,85245710,493128509,945208231,475863350,279284954,813432374,905487747,730092313,198445481,573858992,640307357,280614707,780620191,211244466,611704170,223408333,494598748,968788563,176505672,286582450,993252097,986504187,529362547,560946912,386341399,989315317,14725758,29451516,215685422,95948827,463209666,847826556,571585155,357027634,71359521,142719042,128278247,45877819,700894880,39614801,668371163,336742319,338115610,570799830,972926972]
print(l[n-1])

Submission status: Accepted

Solution code:
from math import factorial
n = int(input())
m = factorial(n)
s = 2
ans = 1
while m > 1:
    c = 1
    while m % s == 0:
        c += 1
        m = m // s
    ans *= c
    s += 1
print(ans % (10**9+7))

Submission status: Accepted

Solution code:
from math import factorial
n = int(input())
m = factorial(n)
s = 2
ans = 1
while m != 1:
    c = 1
    while m % s == 0:
        c += 1
        m = m // s
    ans *= c
    s += 1
print(ans % (10**9+7))

Submission status: Accepted

Solution code:
n = int(input())
import math
num = math.factorial(n)
dic={}
i = 2
ans = 1
while num != 1:
  cnt = 1
  while num%i == 0:
    num = num//i
    cnt+=1
  ans = ans*cnt
  i +=1
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
# https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

table = [0] * (n+1)
for i in range(2, n+1):
  p = prime_factorize(i)
  for pi in p:
    table[pi] += 1
ans = 1
for t in table:
  ans = ans * (t+1) % mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
from collections import defaultdict
p = defaultdict(int)

def f(n):
    for i in range(2, int(n**0.5) + 1):
        x = 0
        while n%i == 0:
            n //= i
            x += 1
        if x:
            p[i] += x
    
    if n > 1:
        p[n] += 1

for i in range(2, n+1):
    f(i)

from functools import reduce
mod = 10**9+7
print(reduce(lambda x, y:x*(y+1), p.values(), 1)%mod)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    d = {}
    mod = 10**9+7
    for i in range(1, n+1):
        d[i] = 0
    
    def prime_factorize(n):
        a = []
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a
    
    for i in range(1, n+1):
        ps = prime_factorize(i)
        for p in ps:
            d[p] += 1
    
    ans = 1
    for i in range(1, n+1):
        if d[i] >= 1:
            ans *= (d[i]+1)
        
    
    print(ans%mod)
        
        
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def factorint(n):
    d = {}
    for factor in range(2, int(n ** 0.5) + 1):
        if n % factor == 0:
            power = 0
            while n % factor == 0:
                power += 1
                n /= factor
            d[factor] = power
    if n != 1:
        d[n] = 1
    return d

def sum_dicts(*dicts):
    d = {}
    for dict in dicts:
        for key in dict:
            try:
                d[key] += dict[key]
            except KeyError:
                d[key] = dict[key]
    return d

n = int(input())
d = {}
for i in range(1, n + 1):
    d = sum_dicts(d, factorint(i))
p = 1
for i in d.values():
    p *= i + 1
    p %= 10 ** 9 + 7
print(p)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def yakusu(n):
    ans = []
    for i in range(1, int(n**(1/2)//1) + 1):
        if n % i == 0:
            ans.append(i)
            ans.append(int(n / i))
    return list(set(ans))


def factorize(n):
    factorial_list = []

    b = 2
    while b * b <= n:
        while n % b == 0:
            n //= b
            factorial_list.append(b)
        b += 1

    if n > 1:
        factorial_list.append(n)
    return factorial_list


MOD = 10 ** 9 + 7


def main():
    N = II()

    fractals = [0] * (N + 1)

    for i in range(1, N+1):
        tmp = factorize(i)
        for fact in tmp:
            fractals[fact] += 1

    ans = 1
    for i in fractals:
        ans *= i + 1
        ans %= MOD

    print(ans)


main()

Submission status: Accepted

Solution code:
n=int(input())
def prime_table(n):
  n+=1
  table=[i if i%2 else 2 for i in range(n)]
  for i in range(3,n,2):
    if table[i]==i:
      for j in range(i*i,n,2*i):
        if table[j]==j:
          table[j]=i
  return table


def prime_fact(n,table):
  p=[]
  while n!=1:
    pp=table[n]
    p.append(pp)
    n//=pp
  return p

t=prime_table(n)

d={}
for i in range(2,n+1):
  for j in prime_fact(i,t):
    if j in d:
      d[j]+=1
    else:
      d[j]=1
c=1
for i in d:
  c=(c*(d[i]+1))%(10**9+7)
print(c)

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

N=intput()
C=counter()
for x in range(1,N+1):
    s=pf(x)
    for k in s:
        C.add(k,s[k])
ans=1
for k in C:
    ans*=C[k]+1
    ans%=MOD
print(ans)

Submission status: Accepted

Solution code:
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal as D  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as F  #F(a,b)で正確なa/b
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

n=int(input())
dp=[0]*1020
dp[1]=1
dp[2]=2
mod=10**9+7
from math import sqrt
def eratosu(n):
  if not isinstance(n,int):
    raise TypeError("nがint型になってねえぞ")
  if n<2:
    raise ValueError('nが2よりちっちぇえぞ')
  prime = []
  limit = sqrt(n)
  data = [i+1 for i in range(1, n)]  #2,3,4,...,n
  while True:
    p = data[0]
    if limit <= p:
        return prime + data
    prime.append(p)
    data = [e  for e in data if e % p != 0]
def bunkai(n):
    if n==2: return [[2,1]]
    if n==3: return [[3,1]]
    ans=[]
    temp=n
    #そんな早くしなくてよかったり、何回もするわけじゃないなら、
    #for i in range(2,int(sqrt(n))+1): とかで
    primelist=eratosu( int(sqrt(n)) )
    for i in primelist:
        if temp % i ==0:
            ji=0
            while temp%i==0:
                ji+=1
                temp//=i
            ans.append([i,ji])
    if ans==[]:return([[n,1]])  #素数のとき
    if temp!=1:
        ans.append([temp,1])  #4*5882353とか
    return ans

NOW=defaultdict(int)
for i in range(2,n+1):
    l=bunkai(i)
    # print(l)
    for info in l:
        NOW[info[0]]+= info[1]

qq=list(NOW.values())
ans=1
for i in qq:
    ans*=(i+1) 
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
def fact(A): #fact(int)
    c0 = A
    r = 2
    lis = []
    count = 1
    while A != 1:
        if A%r == 0:
            A = A//r
            lis.append(r)
            r = 2
        else:
            r += 1
        if r > int(pow(c0,0.5))+1:
            lis.append(A)
            break
    return(lis)

n = int(input())
mod = 10**9+7

L = [0]*(n+1)
for i in range(1,n+1):
    p = fact(i)
    for q in p:
        L[q] += 1
        
ans = 1
for i in range(1,n+1):
    ans *= L[i] + 1
    ans %= mod
    
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    N = int(input())

    def get_sieved_list(x):
        dp = [1 if item % 2 == 0 else 0 for item in range(x+1)]
        dp[:3] = [2,1,1]

        for prim_candi in range(3, x+1):
            temp_num = prim_candi
            while temp_num <= x:
                dp[temp_num] += 1
                temp_num += prim_candi
            if prim_candi >= x:
                return [i  for i in range(x+1) if dp[i] == 1]
                
    
    if N > 2:
        factor_filter = set(get_sieved_list(N))
        prime_list = [0 for _ in range(N+1)]
        for i in factor_filter:
            if i >1:
                for j in range(2, N+1):
                    while j >= 1 and j % i == 0:
                        j //= i
                        prime_list[i] += 1

        res = 1
        for item in prime_list:
            res *= (item+1)
            res %= (10**9+7)
    else:
        res = N

    print(res%(10**9+7))

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import math

n = int(input())

MOD = 10 ** 9 + 7
prime = [0] * (n+1)
yaku = list(range(n+1))

for i in range(n):
    num = i + 1
    # 素因数分解チェック
    for j in range(num+1):
        if j <= 1:
            continue
        else:
            if num % j == 0:
                p = j
                yaku[num] = p
                while num > 1:
                    n_num = num // p
                    prime[p] += 1
                    p = yaku[n_num]
                    num = n_num

ans = 1
for p in prime:
    ans *= (p+1)
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

cnt=[0]*(10**3+1)

for dam in range(2,N+1):
    #素因数分解。
    pf={}
    m=dam
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    # print(pf)
    #{136841: 1, 2: 6, 3: 1, 13: 1}
    for key in pf:
        cnt[key]+=pf[key]

out=1
for i in range(2,10**3+1):
    out*=(cnt[i]+1)
print(out % (10**9+7))