Statistics

Problem Statement for "TheLuckyNumbersLevelThree"

Problem Statement

The digits 4 and 7 are lucky digits, and all other digits are unlucky. A third level lucky number is a positive integer that is divisible by at least one lucky digit. John and Brus have written down all the third level lucky numbers between a and b, inclusive, and now they would like to count the number of occurrences of each digit between 0 and 9, inclusive, in the numbers they have written.

Return a long[] containing exactly 10 elements, where the i-th element (0-based) is the total number of occurrences of digit i.

Definition

Class:
TheLuckyNumbersLevelThree
Method:
find
Parameters:
long, long
Returns:
long[]
Method signature:
long[] find(long a, long b)
(be sure your method is public)

Constraints

  • a will be between 1 and 10^16, inclusive.
  • b will be between a and 10^16, inclusive.

Examples

  1. 1

    10

    Returns: {0, 0, 0, 0, 1, 0, 0, 1, 1, 0 }

    There are three third level lucky numbers in this range - 4, 7, 8.

  2. 78

    79

    Returns: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }

    No third level lucky numbers here.

  3. 1

    47

    Returns: {2, 4, 7, 3, 7, 1, 2, 1, 2, 0 }

  4. 21

    91

    Returns: {4, 2, 7, 4, 9, 3, 7, 5, 7, 2 }

  5. 70

    100

    Returns: {4, 2, 2, 0, 1, 0, 2, 5, 5, 4 }

  6. 71

    76

    Returns: {0, 0, 1, 0, 0, 0, 1, 2, 0, 0 }

  7. 15

    77

    Returns: {4, 2, 8, 4, 8, 3, 8, 5, 3, 1 }

  8. 1972593928314415

    9437714725840869

    Returns: {4211296227100952, 3837161728060723, 4568580537537088, 4184056013807155, 4542976745594672, 4145588611666270, 4529542655351032, 4148134817624030, 4532721191289040, 3957774600691646 }

  9. 1864155292650254

    4102594705839685

    Returns: {1283514920830196, 1181212825601899, 1603907778637370, 1488575675766405, 1283495102380228, 1131789647330307, 1248964955016074, 1135329213244943, 1263250633583878, 1171041608691164 }

  10. 7438115591720206

    9807977131137660

    Returns: {1317624499886679, 1192928626400537, 1314814774448258, 1193609180783697, 1340487773830412, 1232222040474576, 1354100878016180, 1432885785193344, 1678333213557750, 1485059166936871 }

  11. 5080559573987391

    8391076642202521

    Returns: {1854243600410103, 1712602418320560, 1882830209293782, 1709388132217562, 1847115921078437, 2005246936801607, 2204297950436450, 2034041345432060, 1990193091084199, 1677280784725992 }

  12. 5282044706616000

    8493245237374770

    Returns: {1794886520162963, 1629755033308223, 1801636689719936, 1665521152854767, 1828168900398433, 1886131969259566, 2152009592880819, 1986862170365190, 1973866960873909, 1630878328797746 }

  13. 418497480925976

    5179090453708371

    Returns: {2679109386507946, 2784458200151731, 3004076919902546, 2759246424057426, 3033185852022666, 2501814440738966, 2682684058833577, 2437528910480041, 2679292461707655, 2434312290398988 }

  14. 2794849364031515

    8499011279142477

    Returns: {3212747738269011, 2919383439462226, 3286007858233478, 3276525717194024, 3569583549997388, 3241172168987963, 3534529069610990, 3243011685099026, 3391336894304727, 2920912822332399 }

  15. 4797924620882056

    5767164920993966

    Returns: {546409122062320, 496549949800176, 546375328890512, 496530335159820, 618546864604464, 770517806943032, 545362665274477, 481698442382269, 542802014888758, 493723470633676 }

  16. 1841734813461339

    8057841747051409

    Returns: {3502042389077618, 3218317025194633, 3838884268683747, 3519200621769610, 3841836810904753, 3521999747150125, 3838884622647558, 3519165865953721, 3522866289140945, 3197413408563402 }

  17. 1873140226833474

    9070736374533801

    Returns: {4059198556613792, 3708838977624533, 4390851254506262, 4020994936875151, 4391208292494583, 4021046285696267, 4391208149958897, 4020164684887028, 4400765074791985, 3724844630553374 }

  18. 4794061637486946

    5595540826819352

    Returns: {456954979834683, 415757897661879, 456977053933602, 415758122658517, 530858323590406, 627027163681495, 421226492550046, 382129004663518, 456941350370495, 416250692954847 }

  19. 499164553358787

    6101377855809013

    Returns: {3160132198219471, 3193237407822453, 3480747249713021, 3192625514333952, 3481010069135315, 3228312369159031, 3195491679198815, 2871172284061310, 3159282983937430, 2871765884620061 }

  20. 6812197565980234

    8079884517009348

    Returns: {727969729683442, 637031667923750, 703333267894873, 638208498263457, 703403654676849, 638208123638037, 770475769687621, 995309912920034, 759713111122642, 670271698641375 }

  21. 1

    10000000000000000

    Returns: {5574603174603188, 5457142857142856, 5971428571428569, 5457142857142862, 5971428571428572, 5457142857142853, 5971428571428575, 5457142857142857, 5971428571428569, 5457142857142854 }

  22. 123456789

    987654321

    Returns: {266686266, 249578679, 304737405, 261721506, 306344271, 261919110, 306348199, 261761186, 305134230, 253546932 }

  23. 2972593928314404

    3437714725839265

    Returns: {281296227100453, 257373845315196, 291225563138316, 413239844463065, 255833888450141, 218445754522696, 242399798207950, 220991960479314, 245578334145398, 231447912890975 }

  24. 5102594705838734

    8864155292649157

    Returns: {2085056507741805, 1927303141308654, 2121806507076435, 1928567181376786, 2121717292562153, 2248712243441380, 2476749330697412, 2281813643898236, 2413947685219425, 1888958391308722 }

  25. 3807977131137206

    7438115591718426

    Returns: {2050946928684638, 1867071373597348, 2053756654122966, 1934970415238360, 2385226511883080, 2184920816666913, 2371613407697925, 1984257071948758, 2047381072155654, 1863504094182758 }

  26. 1391076642201748

    9080559573985977

    Returns: {4321470685303634, 4114870209464835, 4650026933564006, 4257754724925003, 4685741221778916, 4290267501058472, 4685702049563646, 4290244368853244, 4682334281129922, 3961490491696802 }

  27. 6282044706615829

    7493245237373551

    Returns: {672029377305798, 609755033308195, 678779546861908, 645521152853214, 705311757540125, 609719364479091, 928422197660823, 785878326569109, 674850804668584, 610878328797265 }

  28. 5179090453707661

    6418497480924840

    Returns: {689462042063796, 632684656990956, 721637365811297, 657896433085654, 692528433690528, 915328416403989, 835350755782377, 622471089520162, 689278966863038, 625687709600667 }

  29. 4499011279140701

    8794849364031409

    Returns: {2401537976017639, 2180616560540149, 2401545940327738, 2180617139948904, 2580769564596581, 2573113545297860, 2794042358960601, 2571274029187438, 2685041906828996, 2179087177669582 }

  30. 3797924620880317

    6767164920992345

    Returns: {1669266264919778, 1516549949799954, 1669232471748124, 1588700113416520, 2026377086348106, 1873673192302334, 1942207279914071, 1501698442382351, 1665659157747151, 1513723470633195 }

  31. 7714722954981

    6972593928314396

    Returns: {3873689487882057, 3911926156263364, 4269976607063782, 3911570674898858, 4269764230001460, 3911568532038328, 4259940891172877, 3551879471731200, 3909407380815737, 3541423516209333 }

  32. 9155290675881

    9102594705837974

    Returns: {5099786349991558, 4992854002983943, 5459464922906565, 4991589961853902, 5459252455287241, 4991589649109731, 5459220417139786, 4991557785045008, 5459220381433671, 4671355686613289 }

  33. 7977130321698

    7438115591717002

    Returns: {4155081618820118, 4169357088358467, 4551470940006189, 4168676533947041, 4525797940655720, 4130063673968610, 4512184836471081, 3929399930123612, 4155087190619686, 3772932666061612 }

  34. 6076640812842

    5080559573984845

    Returns: {2836727829075352, 2943239240249061, 3204212648241834, 2943239240245023, 3204212651166070, 2614853063442711, 2847360393442306, 2586415798168650, 2844019995765652, 2582846587771399 }

  35. 7044706308943

    8493245237372576

    Returns: {4744100806159235, 4704112176214120, 5140525765934805, 4703806867216904, 5137740329285350, 4668005078846826, 5104438164486669, 4668346203980612, 4923811499012229, 4308806900272173 }

  36. 9090452431335

    5418497480923931

    Returns: {3022047757556943, 3139774104971373, 3414937366307778, 3136739290712468, 3385828434466930, 2893309822352836, 3022044512927962, 2743846251792602, 3021864681445053, 2743816282171598 }

  37. 9011275946777

    7794849364031324

    Returns: {4340209406525374, 4336230849145748, 4736645942228115, 4336231426258536, 4736591907597355, 4335870688769442, 4736285217220339, 4260763089863610, 4343409992220654, 3941491207739796 }

  38. 7924617753096

    5767164920991048

    Returns: {3204223408835547, 3304449951185452, 3600618188209102, 3304430335743629, 3600619945352318, 3221274950385786, 3242462667138401, 2931714380219668, 3204187730306612, 2908025123004399 }

  39. 7841745491797

    6841734813460368

    Returns: {3805972520957401, 3850849113686437, 4202044303100483, 3850585092790929, 4199091761995347, 3847015163000709, 4141949240047142, 3489905564057339, 3820862907178674, 3454515163175743 }

  40. 8140224471099

    9070736374533451

    Returns: {5073227129441065, 4978074774200030, 5444165542463595, 4978087875461109, 5444165436946208, 4978089143662009, 5444165293700932, 4974757623510514, 5440865076202875, 4642958916701299 }

  41. 869

    9999999999999315

    Returns: {5574603174603029, 5457142857142749, 5971428571428381, 5457142857142725, 5971428571428345, 5457142857142711, 5971428571428351, 5457142857142714, 5971428571428360, 5457142857139577 }

  42. 254

    9999999999999513

    Returns: {5574603174603107, 5457142857142786, 5971428571428475, 5457142857142827, 5971428571428496, 5457142857142791, 5971428571428470, 5457142857142788, 5971428571428463, 5457142857140551 }

  43. 660

    9999999999999398

    Returns: {5574603174603053, 5457142857142761, 5971428571428407, 5457142857142769, 5971428571428376, 5457142857142723, 5971428571428399, 5457142857142765, 5971428571428413, 5457142857139981 }

  44. 521

    9999999999999786

    Returns: {5574603174603104, 5457142857142783, 5971428571428461, 5457142857142795, 5971428571428464, 5457142857142815, 5971428571428506, 5457142857142819, 5971428571428462, 5457142857141809 }

  45. 1000

    9999999999999923

    Returns: {5574603174603077, 5457142857142773, 5971428571428429, 5457142857142776, 5971428571428428, 5457142857142770, 5971428571428433, 5457142857142770, 5971428571428428, 5457142857142392 }

  46. 371

    9999999999999241

    Returns: {5574603174603069, 5457142857142769, 5971428571428404, 5457142857142752, 5971428571428422, 5457142857142764, 5971428571428430, 5457142857142769, 5971428571428424, 5457142857139260 }

  47. 477

    9999999999999841

    Returns: {5574603174603118, 5457142857142792, 5971428571428471, 5457142857142800, 5971428571428478, 5457142857142824, 5971428571428511, 5457142857142825, 5971428571428488, 5457142857142063 }

  48. 4972464874487544

    9748579857455874

    Returns: {2690073130914705, 2444444360362052, 2690264247169156, 2444801503219197, 2699769643226866, 2798401808900469, 3044003886808127, 2782703587641372, 3011709145349260, 2685914303370700 }

  49. 1

    593847321343234

    Returns: {308672700679877, 317814520744491, 348355236913549, 317759960846495, 347997101160763, 315256381776236, 312280200679877, 281739238919098, 312261029731033, 279506024633380 }


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: