All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Distinct Values Determination (Posted on 2015-10-20) Difficulty: 3 of 5
It is known that X is a real number with 0 ≤ X ≤ 100

Find the total count of distinct values that can be assumed by this expression:

floor(X) + floor(2*X) + floor(5*X /3) + floor(3*X) + floor(4*X)

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution differs | Comment 2 of 4 |
I was originally going to attempt an analytic solution, along these lines:

Changes to floor(2*x) always coincide with a change in floor(x), so can be ignored.

floor(5*x/3) changes every 3/5: 0, .6, 1.2, 1.8, 2.4, 3, ..., so it takes on 5 values within a span of 3 units or 165 values up to x=99. Then there are another 2. But now values 0, 3, ... , 99 are coincidental with others, so 34 don't count. Net: add 131 to the previous total of 101, making 232.

Changes to  ...

but then I realized that we're talking about real numbers.

I switched to a computer solution, thinking the inclusions and exclusions would be very unwieldy.

DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 currval = -1
 For x = 0 To 100 Step 1 / 128#
  v = Int(x) + Int(2 * x) + Int(5 * x / 3) + Int(3 * x) + Int(4 * x)
  If v > currval Then
    ct = ct + 1
    currval = v
  End If
 Next

 Text1.Text = Text1.Text & ct & crlf & " done"
  
End Sub

finds only 734 values. The 1/128 is used so as to be a smaller interval than the necessary 1/60 and also hit 100 exactly, as 128 is a power of 2, used in the binary format the computer uses. In fact, changing the 128 to 120 lowers the count by 1, to 733, as 100 is missed.

Adding a couple of lines and getting around the precision problem via separate numerator and denominator, we get the values:

value | starting at x=
0 0
1 .25
2 .3375
4 .5
5 .6
6 .666666666666667
7 .75
11 1
12 1.2
13 1.25
14 1.33333333333333
16 1.5
17 1.66666666666667
18 1.75
19 1.8
23 2
24 2.25
25 2.33333333333333
26 2.4
28 2.5
29 2.66666666666667
30 2.75
35 3
36 3.25
37 3.33333333333333
39 3.5
40 3.6
41 3.66666666666667
42 3.75
46 4
47 4.2
48 4.25
49 4.33333333333333
51 4.5
52 4.66666666666667
53 4.75
54 4.8
58 5
59 5.25
60 5.33333333333333
61 5.4
63 5.5
64 5.66666666666667
65 5.75
70 6
71 6.25
72 6.33333333333333
74 6.5
75 6.6
76 6.66666666666667
77 6.75
81 7
82 7.2
83 7.25
84 7.33333333333333
86 7.5
87 7.66666666666667
88 7.75
89 7.8
93 8
94 8.25
95 8.33333333333333
96 8.4
98 8.5
99 8.66666666666667
100 8.75
105 9
106 9.25
107 9.33333333333333
109 9.5
110 9.6
111 9.66666666666667
112 9.75
116 10
117 10.2
118 10.25
119 10.3333333333333
121 10.5
122 10.6666666666667
123 10.75
124 10.8
128 11
129 11.25
130 11.3333333333333
131 11.4
133 11.5
134 11.6666666666667
135 11.75
140 12
141 12.25
142 12.3333333333333
144 12.5
145 12.6
146 12.6666666666667
147 12.75
151 13
152 13.2
153 13.25
154 13.3333333333333
156 13.5
157 13.6666666666667
158 13.75
159 13.8
163 14
164 14.25
165 14.3333333333333
166 14.4
168 14.5
169 14.6666666666667
170 14.75
175 15
176 15.25
177 15.3333333333333
179 15.5
180 15.6
181 15.6666666666667
182 15.75
186 16
187 16.2
188 16.25
189 16.3333333333333
191 16.5
192 16.6666666666667
193 16.75
194 16.8
198 17
199 17.25
200 17.3333333333333
201 17.4
203 17.5
204 17.6666666666667
205 17.75
210 18
211 18.25
212 18.3333333333333
214 18.5
215 18.6
216 18.6666666666667
217 18.75
221 19
222 19.2
223 19.25
224 19.3333333333333
226 19.5
227 19.6666666666667
228 19.75
229 19.8
233 20
234 20.25
235 20.3333333333333
236 20.4
238 20.5
239 20.6666666666667
240 20.75
245 21
246 21.25
247 21.3333333333333
249 21.5
250 21.6
251 21.6666666666667
252 21.75
256 22
257 22.2
258 22.25
259 22.3333333333333
261 22.5
262 22.6666666666667
263 22.75
264 22.8
268 23
269 23.25
270 23.3333333333333
271 23.4
273 23.5
274 23.6666666666667
275 23.75
280 24
281 24.25
282 24.3333333333333
284 24.5
285 24.6
286 24.6666666666667
287 24.75
291 25
292 25.2
293 25.25
294 25.3333333333333
296 25.5
297 25.6666666666667
298 25.75
299 25.8
303 26
304 26.25
305 26.3333333333333
306 26.4
308 26.5
309 26.6666666666667
310 26.75
315 27
316 27.25
317 27.3333333333333
319 27.5
320 27.6
321 27.6666666666667
322 27.75
326 28
327 28.2
328 28.25
329 28.3333333333333
331 28.5
332 28.6666666666667
333 28.75
334 28.8
338 29
339 29.25
340 29.3333333333333
341 29.4
343 29.5
344 29.6666666666667
345 29.75
350 30
351 30.25
352 30.3333333333333
354 30.5
355 30.6
356 30.6666666666667
357 30.75
361 31
362 31.2
363 31.25
364 31.3333333333333
366 31.5
367 31.6666666666667
368 31.75
369 31.8
373 32
374 32.25
375 32.3333333333333
376 32.4
378 32.5
379 32.6666666666667
380 32.75
385 33
386 33.25
387 33.3333333333333
389 33.5
390 33.6
391 33.6666666666667
392 33.75
396 34
397 34.2
398 34.25
399 34.3333333333333
401 34.5
402 34.6666666666667
403 34.75
404 34.8
408 35
409 35.25
410 35.3333333333333
411 35.4
413 35.5
414 35.6666666666667
415 35.75
420 36
421 36.25
422 36.3333333333333
424 36.5
425 36.6
426 36.6666666666667
427 36.75
431 37
432 37.2
433 37.25
434 37.3333333333333
436 37.5
437 37.6666666666667
438 37.75
439 37.8
443 38
444 38.25
445 38.3333333333333
446 38.4
448 38.5
449 38.6666666666667
450 38.75
455 39
456 39.25
457 39.3333333333333
459 39.5
460 39.6
461 39.6666666666667
462 39.75
466 40
467 40.2
468 40.25
469 40.3333333333333
471 40.5
472 40.6666666666667
473 40.75
474 40.8
478 41
479 41.25
480 41.3333333333333
481 41.4
483 41.5
484 41.6666666666667
485 41.75
490 42
491 42.25
492 42.3333333333333
494 42.5
495 42.6
496 42.6666666666667
497 42.75
501 43
502 43.2
503 43.25
504 43.3333333333333
506 43.5
507 43.6666666666667
508 43.75
509 43.8
513 44
514 44.25
515 44.3333333333333
516 44.4
518 44.5
519 44.6666666666667
520 44.75
525 45
526 45.25
527 45.3333333333333
529 45.5
530 45.6
531 45.6666666666667
532 45.75
536 46
537 46.2
538 46.25
539 46.3333333333333
541 46.5
542 46.6666666666667
543 46.75
544 46.8
548 47
549 47.25
550 47.3333333333333
551 47.4
553 47.5
554 47.6666666666667
555 47.75
560 48
561 48.25
562 48.3333333333333
564 48.5
565 48.6
566 48.6666666666667
567 48.75
571 49
572 49.2
573 49.25
574 49.3333333333333
576 49.5
577 49.6666666666667
578 49.75
579 49.8
583 50
584 50.25
585 50.3333333333333
586 50.4
588 50.5
589 50.6666666666667
590 50.75
595 51
596 51.25
597 51.3333333333333
599 51.5
600 51.6
601 51.6666666666667
602 51.75
606 52
607 52.2
608 52.25
609 52.3333333333333
611 52.5
612 52.6666666666667
613 52.75
614 52.8
618 53
619 53.25
620 53.3333333333333
621 53.4
623 53.5
624 53.6666666666667
625 53.75
630 54
631 54.25
632 54.3333333333333
634 54.5
635 54.6
636 54.6666666666667
637 54.75
641 55
642 55.2
643 55.25
644 55.3333333333333
646 55.5
647 55.6666666666667
648 55.75
649 55.8
653 56
654 56.25
655 56.3333333333333
656 56.4
658 56.5
659 56.6666666666667
660 56.75
665 57
666 57.25
667 57.3333333333333
669 57.5
670 57.6
671 57.6666666666667
672 57.75
676 58
677 58.2
678 58.25
679 58.3333333333333
681 58.5
682 58.6666666666667
683 58.75
684 58.8
688 59
689 59.25
690 59.3333333333333
691 59.4
693 59.5
694 59.6666666666667
695 59.75
700 60
701 60.25
702 60.3333333333333
704 60.5
705 60.6
706 60.6666666666667
707 60.75
711 61
712 61.2
713 61.25
714 61.3333333333333
716 61.5
717 61.6666666666667
718 61.75
719 61.8
723 62
724 62.25
725 62.3333333333333
726 62.4
728 62.5
729 62.6666666666667
730 62.75
735 63
736 63.25
737 63.3333333333333
739 63.5
740 63.6
741 63.6666666666667
742 63.75
746 64
747 64.2
748 64.25
749 64.3333333333333
751 64.5
752 64.6666666666667
753 64.75
754 64.8
758 65
759 65.25
760 65.3333333333333
761 65.4
763 65.5
764 65.6666666666667
765 65.75
770 66
771 66.25
772 66.3333333333333
774 66.5
775 66.6
776 66.6666666666667
777 66.75
781 67
782 67.2
783 67.25
784 67.3333333333333
786 67.5
787 67.6666666666667
788 67.75
789 67.8
793 68
794 68.25
795 68.3333333333333
796 68.4
798 68.5
799 68.6666666666667
800 68.75
805 69
806 69.25
807 69.3333333333333
809 69.5
810 69.6
811 69.6666666666667
812 69.75
816 70
817 70.2
818 70.25
819 70.3333333333333
821 70.5
822 70.6666666666667
823 70.75
824 70.8
828 71
829 71.25
830 71.3333333333333
831 71.4
833 71.5
834 71.6666666666667
835 71.75
840 72
841 72.25
842 72.3333333333333
844 72.5
845 72.6
846 72.6666666666667
847 72.75
851 73
852 73.2
853 73.25
854 73.3333333333333
856 73.5
857 73.6666666666667
858 73.75
859 73.8
863 74
864 74.25
865 74.3333333333333
866 74.4
868 74.5
869 74.6666666666667
870 74.75
875 75
876 75.25
877 75.3333333333333
879 75.5
880 75.6
881 75.6666666666667
882 75.75
886 76
887 76.2
888 76.25
889 76.3333333333333
891 76.5
892 76.6666666666667
893 76.75
894 76.8
898 77
899 77.25
900 77.3333333333333
901 77.4
903 77.5
904 77.6666666666667
905 77.75
910 78
911 78.25
912 78.3333333333333
914 78.5
915 78.6
916 78.6666666666667
917 78.75
921 79
922 79.2
923 79.25
924 79.3333333333333
926 79.5
927 79.6666666666667
928 79.75
929 79.8
933 80
934 80.25
935 80.3333333333333
936 80.4
938 80.5
939 80.6666666666667
940 80.75
945 81
946 81.25
947 81.3333333333333
949 81.5
950 81.6
951 81.6666666666667
952 81.75
956 82
957 82.2
958 82.25
959 82.3333333333333
961 82.5
962 82.6666666666667
963 82.75
964 82.8
968 83
969 83.25
970 83.3333333333333
971 83.4
973 83.5
974 83.6666666666667
975 83.75
980 84
981 84.25
982 84.3333333333333
984 84.5
985 84.6
986 84.6666666666667
987 84.75
991 85
992 85.2
993 85.25
994 85.3333333333333
996 85.5
997 85.6666666666667
998 85.75
999 85.8
1003 86
1004 86.25
1005 86.3333333333333
1006 86.4
1008 86.5
1009 86.6666666666667
1010 86.75
1015 87
1016 87.25
1017 87.3333333333333
1019 87.5
1020 87.6
1021 87.6666666666667
1022 87.75
1026 88
1027 88.2
1028 88.25
1029 88.3333333333333
1031 88.5
1032 88.6666666666667
1033 88.75
1034 88.8
1038 89
1039 89.25
1040 89.3333333333333
1041 89.4
1043 89.5
1044 89.6666666666667
1045 89.75
1050 90
1051 90.25
1052 90.3333333333333
1054 90.5
1055 90.6
1056 90.6666666666667
1057 90.75
1061 91
1062 91.2
1063 91.25
1064 91.3333333333333
1066 91.5
1067 91.6666666666667
1068 91.75
1069 91.8
1073 92
1074 92.25
1075 92.3333333333333
1076 92.4
1078 92.5
1079 92.6666666666667
1080 92.75
1085 93
1086 93.25
1087 93.3333333333333
1089 93.5
1090 93.6
1091 93.6666666666667
1092 93.75
1096 94
1097 94.2
1098 94.25
1099 94.3333333333333
1101 94.5
1102 94.6666666666667
1103 94.75
1104 94.8
1108 95
1109 95.25
1110 95.3333333333333
1111 95.4
1113 95.5
1114 95.6666666666667
1115 95.75
1120 96
1121 96.25
1122 96.3333333333333
1124 96.5
1125 96.6
1126 96.6666666666667
1127 96.75
1131 97
1132 97.2
1133 97.25
1134 97.3333333333333
1136 97.5
1137 97.6666666666667
1138 97.75
1139 97.8
1143 98
1144 98.25
1145 98.3333333333333
1146 98.4
1148 98.5
1149 98.6666666666667
1150 98.75
1155 99
1156 99.25
1157 99.3333333333333
1159 99.5
1160 99.6
1161 99.6666666666667
1162 99.75
1166 100
734
 done
 
 
DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 currval = -1
 For num = 0# To 24000
  x = num / 240
  v = Int(x) + Int(2 * num / 240) + Int(5 * num / (240 * 3)) + Int(3 * num / 240) + Int(4 * num / 240)
  If v > currval Then
    ct = ct + 1
    currval = v
    Text1.Text = Text1.Text & currval & Str(x) & crlf
    DoEvents
  End If
 Next

 Text1.Text = Text1.Text & ct & crlf & " done"
  
End Sub


  Posted by Charlie on 2015-10-20 11:25:46
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information