Cody

Problem 44375. Missing five

Solution 2912617

Submitted on 4 Sep 2020 by Rachelle Lee
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(regexprep(char(string(dec2missing5(3))),'^0*',''),'3'))

f = 1 y = 3

2   Pass
assert(isequal(regexprep(char(string(dec2missing5(14))),'^0*',''),'16'))

f = 1 y = 16

3   Pass
assert(isequal(regexprep(char(string(dec2missing5(19))),'^0*',''),'21'))

f = 1 y = 21

4   Pass
assert(isequal(regexprep(char(string(dec2missing5(80))),'^0*',''),'99'))

f = 1 y = 99

5   Pass
assert(isequal(regexprep(char(string(dec2missing5(91))),'^0*',''),'111'))

f = 1 y = 111

6   Pass
assert(isequal(regexprep(char(string(dec2missing5(313))),'^0*',''),'388'))

f = 1 y = 388

7   Pass
assert(isequal(regexprep(char(string(dec2missing5(732))),'^0*',''),'1003'))

f = 1 y = 1003

8   Pass
assert(isequal(regexprep(char(string(dec2missing5(748))),'^0*',''),'1021'))

f = 1 y = 1021

9   Pass
assert(isequal(regexprep(char(string(dec2missing5(1249))),'^0*',''),'1738'))

f = 1 y = 1738

10   Pass
assert(isequal(regexprep(char(string(dec2missing5(1873))),'^0*',''),'2611'))

f = 1 y = 2611

11   Pass
assert(isequal(regexprep(char(string(dec2missing5(2790))),'^0*',''),'3840'))

f = 1 y = 3840

12   Pass
assert(isequal(regexprep(char(string(dec2missing5(3035))),'^0*',''),'4142'))

f = 1 y = 4142

13   Pass
assert(isequal(regexprep(char(string(dec2missing5(3391))),'^0*',''),'4688'))

f = 1 y = 4688

14   Pass
assert(isequal(regexprep(char(string(dec2missing5(3547))),'^0*',''),'4881'))

f = 1 y = 4881

15   Pass
assert(isequal(regexprep(char(string(dec2missing5(3724))),'^0*',''),'6098'))

f = 1 y = 6098

16   Pass
assert(isequal(regexprep(char(string(dec2missing5(4057))),'^0*',''),'6608'))

f = 1 y = 6608

17   Pass
assert(isequal(regexprep(char(string(dec2missing5(4221))),'^0*',''),'6810'))

f = 1 y = 6810

18   Pass
assert(isequal(regexprep(char(string(dec2missing5(4389))),'^0*',''),'7017'))

f = 1 y = 7017

19   Pass
assert(isequal(regexprep(char(string(dec2missing5(4444))),'^0*',''),'7088'))

f = 1 y = 7088

20   Pass
assert(isequal(regexprep(char(string(dec2missing5(4489))),'^0*',''),'7138'))

f = 1 y = 7138

21   Pass
assert(isequal(regexprep(char(string(dec2missing5(4530))),'^0*',''),'7193'))

f = 1 y = 7193

22   Pass
assert(isequal(regexprep(char(string(dec2missing5(4533))),'^0*',''),'7197'))

f = 1 y = 7197

23   Pass
assert(isequal(regexprep(char(string(dec2missing5(4569))),'^0*',''),'7237'))

f = 1 y = 7237

24   Pass
assert(isequal(regexprep(char(string(dec2missing5(4585))),'^0*',''),'7264'))

f = 1 y = 7264

25   Pass
assert(isequal(regexprep(char(string(dec2missing5(4651))),'^0*',''),'7338'))

f = 1 y = 7338

26   Pass
assert(isequal(regexprep(char(string(dec2missing5(4680))),'^0*',''),'7380'))

f = 1 y = 7380

27   Pass
assert(isequal(regexprep(char(string(dec2missing5(5455))),'^0*',''),'8431'))

f = 1 y = 8431

28   Pass
assert(isequal(regexprep(char(string(dec2missing5(5711))),'^0*',''),'8846'))

f = 1 y = 8846

29   Pass
assert(isequal(regexprep(char(string(dec2missing5(5949))),'^0*',''),'9140'))

f = 1 y = 9140

30   Pass
assert(isequal(regexprep(char(string(dec2missing5(5999))),'^0*',''),'9206'))

f = 1 y = 9206

31   Pass
assert(isequal(regexprep(char(string(dec2missing5(6075))),'^0*',''),'9300'))

f = 1 y = 9300

32   Pass
assert(isequal(regexprep(char(string(dec2missing5(6526))),'^0*',''),'9961'))

f = 1 y = 9961

33   Pass
assert(isequal(regexprep(char(string(dec2missing5(6601))),'^0*',''),'10044'))

f = 1 y = 10044

34   Pass
assert(isequal(regexprep(char(string(dec2missing5(6634))),'^0*',''),'10091'))

f = 1 y = 10091

35   Pass
assert(isequal(regexprep(char(string(dec2missing5(6728))),'^0*',''),'10206'))

f = 1 y = 10206

36   Pass
assert(isequal(regexprep(char(string(dec2missing5(6787))),'^0*',''),'10281'))

f = 1 y = 10281

37   Pass
assert(isequal(regexprep(char(string(dec2missing5(6902))),'^0*',''),'10419'))

f = 1 y = 10419

38   Pass
assert(isequal(regexprep(char(string(dec2missing5(7037))),'^0*',''),'10689'))

f = 1 y = 10689

39   Pass
assert(isequal(regexprep(char(string(dec2missing5(7212))),'^0*',''),'10903'))

f = 1 y = 10903

40   Pass
assert(isequal(regexprep(char(string(dec2missing5(7493))),'^0*',''),'11246'))

f = 1 y = 11246

41   Pass
assert(isequal(regexprep(char(string(dec2missing5(7962))),'^0*',''),'11927'))

f = 1 y = 11927

42   Pass
assert(isequal(regexprep(char(string(dec2missing5(7996))),'^0*',''),'11974'))

f = 1 y = 11974

43   Pass
assert(isequal(regexprep(char(string(dec2missing5(8062))),'^0*',''),'12048'))

f = 1 y = 12048

44   Pass
assert(isequal(regexprep(char(string(dec2missing5(8109))),'^0*',''),'12110'))

f = 1 y = 12110

45   Pass
assert(isequal(regexprep(char(string(dec2missing5(8248))),'^0*',''),'12284'))

f = 1 y = 12284

46   Pass
assert(isequal(regexprep(char(string(dec2missing5(8427))),'^0*',''),'12603'))

f = 1 y = 12603

47   Pass
assert(isequal(regexprep(char(string(dec2missing5(8538))),'^0*',''),'12737'))

f = 1 y = 12737

48   Pass
assert(isequal(regexprep(char(string(dec2missing5(8620))),'^0*',''),'12838'))

f = 1 y = 12838

49   Pass
assert(isequal(regexprep(char(string(dec2missing5(8959))),'^0*',''),'13264'))

f = 1 y = 13264

50   Pass
assert(isequal(regexprep(char(string(dec2missing5(9190))),'^0*',''),'13641'))

f = 1 y = 13641

51   Pass
assert(isequal(regexprep(char(string(dec2missing5(9289))),'^0*',''),'13771'))

f = 1 y = 13771

52   Pass
assert(isequal(regexprep(char(string(dec2missing5(9436))),'^0*',''),'13944'))

f = 1 y = 13944

53   Pass
assert(isequal(regexprep(char(string(dec2missing5(9480))),'^0*',''),'14003'))

f = 1 y = 14003

54   Pass
assert(isequal(regexprep(char(string(dec2missing5(9533))),'^0*',''),'14072'))

f = 1 y = 14072

55   Pass
assert(isequal(regexprep(char(string(dec2missing5(9541))),'^0*',''),'14081'))

f = 1 y = 14081

56   Pass
for n=1:100, assert(all(char(string(dec2missing5(randi(10000))))~='5')); end

f = 1 y = 14068 f = 1 y = 11282 f = 1 y = 12218 f = 1 y = 3762 f = 1 y = 12904 f = 1 y = 988 f = 1 y = 3697 f = 1 y = 2802 f = 1 y = 1439 f = 1 y = 7878 f = 1 y = 10612 f = 1 y = 6412 f = 1 y = 2842 f = 1 y = 8471 f = 1 y = 476 f = 1 y = 3347 f = 1 y = 10790 f = 1 y = 11846 f = 1 y = 8728 f = 1 y = 7881 f = 1 y = 10286 f = 1 y = 12019 f = 1 y = 1062 f = 1 y = 110 f = 1 y = 12093 f = 1 y = 4872 f = 1 y = 3643 f = 1 y = 6833 f = 1 y = 2987 f = 1 y = 6818 f = 1 y = 447 f = 1 y = 1827 f = 1 y = 14334 f = 1 y = 9916 f = 1 y = 7009 f = 1 y = 13707 f = 1 y = 2446 f = 1 y = 14437 f = 1 y = 6418 f = 1 y = 2961 f = 1 y = 9882 f = 1 y = 8278 f = 1 y = 13201 f = 1 y = 9130 f = 1 y = 12630 f = 1 y = 6360 f = 1 y = 2983 f = 1 y = 2723 f = 1 y = 12681 f = 1 y = 9930 f = 1 y = 14710 f = 1 y = 6317 f = 1 y = 4924 f = 1 y = 280 f = 1 y = 11723 f = 1 y = 9740 f = 1 y = 7303 f = 1 y = 2974 f = 1 y = 110 f = 1 y = 9182 f = 1 y = 388 f = 1 y = 9377 f = 1 y = 8136 f = 1 y = 2017 f = 1 y = 13009 f = 1 y = 6403 f = 1 y = 10182 f = 1 y = 6618 f = 1 y = 6208 f = 1 y = 12791 f = 1 y = 4697 f = 1 y = 11131 f = 1 y = 463 f = 1 y = 6211 f = 1 y = 10096 f = 1 y = 7903 f = 1 y = 2077 f = 1 y = 240 f = 1 y = 11747 f = 1 y = 2728 f = 1 y = 9019 f = 1 y = 12849 f = 1 y = 11701 f = 1 y = 14666 f = 1 y = 6899 f = 1 y = 8347 f = 1 y = 10864 f = 1 y = 8221 f = 1 y = 13027 f = 1 y = 13691 f = 1 y = 3849 f = 1 y = 3009 f = 1 y = 10621 f = 1 y = 2646 f = 1 y = 12643 f = 1 y = 4463 f = 1 y = 7079 f = 1 y = 3039 f = 1 y = 8294 f = 1 y = 419

57   Pass
x='1000'; for n=1:7, x=char(string(dec2missing5(str2double(x)))); end; assert(isequal(regexprep(x,'^0*',''),'11027'));

f = 1 y = 1331 f = 1 y = 1839 f = 1 y = 2473 f = 1 y = 3348 f = 1 y = 4630 f = 1 y = 7314 f = 1 y = 11027

58   Pass
x='234'; for n=1:10, x=char(string(dec2missing5(str2double(x)))); end; assert(isequal(regexprep(x,'^0*',''),'4240'));

f = 1 y = 290 f = 1 y = 362 f = 1 y = 442 f = 1 y = 641 f = 1 y = 892 f = 1 y = 1201 f = 1 y = 1684 f = 1 y = 2281 f = 1 y = 3114 f = 1 y = 4240

59   Pass
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13944,14003,14072,14081]),regexp(fileread('dec2missing5.m'),'((\s*[\+\-\*\/]\s*)?[\d\.])+','match'))),'please do not use look-up table solutions');

Suggested Problems

More from this Author38

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!