A certain performer tries to impress his audience by guessing the birthday date of a volunteer (previously unknown to him).
The volunteer is requested to multiply the numerical value of the month of his birth by 31, to multiply the numerical value of the day by 12, to add the two products and announce the result, say N.
Upon getting the result the performer, considerably quickly, deduces the MM/DD of the relevant birthdate.
a. Devise a way to quickly solve 12*d+31*m=N.
b. Show that there is a unique solution for any N, evaluated as described above.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For mo = 1 To 12
For da = 1 To 31
DoEvents
Text1.Text = Text1.Text & mform(mo, "#0") & mform(da, "##0") & mform(12 * da + 31 * mo, "##########0") & crlf
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
The program's output can be copied to a file and sorted by N, which lets you see there is no repeated N (even with the inclusion of impossible dates, like February 31), so part B is easy:
1 1 43
1 2 55
1 3 67
2 1 74
1 4 79
2 2 86
1 5 91
2 3 98
1 6 103
3 1 105
2 4 110
1 7 115
3 2 117
2 5 122
1 8 127
3 3 129
2 6 134
4 1 136
1 9 139
3 4 141
2 7 146
4 2 148
1 10 151
3 5 153
2 8 158
4 3 160
1 11 163
3 6 165
5 1 167
2 9 170
4 4 172
1 12 175
3 7 177
5 2 179
2 10 182
4 5 184
1 13 187
3 8 189
5 3 191
2 11 194
4 6 196
6 1 198
1 14 199
3 9 201
5 4 203
2 12 206
4 7 208
6 2 210
1 15 211
3 10 213
5 5 215
2 13 218
4 8 220
6 3 222
1 16 223
3 11 225
5 6 227
7 1 229
2 14 230
4 9 232
6 4 234
1 17 235
3 12 237
5 7 239
7 2 241
2 15 242
4 10 244
6 5 246
1 18 247
3 13 249
5 8 251
7 3 253
2 16 254
4 11 256
6 6 258
1 19 259
8 1 260
3 14 261
5 9 263
7 4 265
2 17 266
4 12 268
6 7 270
1 20 271
8 2 272
3 15 273
5 10 275
7 5 277
2 18 278
4 13 280
6 8 282
1 21 283
8 3 284
3 16 285
5 11 287
7 6 289
2 19 290
9 1 291
4 14 292
6 9 294
1 22 295
8 4 296
3 17 297
5 12 299
7 7 301
2 20 302
9 2 303
4 15 304
6 10 306
1 23 307
8 5 308
3 18 309
5 13 311
7 8 313
2 21 314
9 3 315
4 16 316
6 11 318
1 24 319
8 6 320
3 19 321
10 1 322
5 14 323
7 9 325
2 22 326
9 4 327
4 17 328
6 12 330
1 25 331
8 7 332
3 20 333
10 2 334
5 15 335
7 10 337
2 23 338
9 5 339
4 18 340
6 13 342
1 26 343
8 8 344
3 21 345
10 3 346
5 16 347
7 11 349
2 24 350
9 6 351
4 19 352
11 1 353
6 14 354
1 27 355
8 9 356
3 22 357
10 4 358
5 17 359
7 12 361
2 25 362
9 7 363
4 20 364
11 2 365
6 15 366
1 28 367
8 10 368
3 23 369
10 5 370
5 18 371
7 13 373
2 26 374
9 8 375
4 21 376
11 3 377
6 16 378
1 29 379
8 11 380
3 24 381
10 6 382
5 19 383
12 1 384
7 14 385
2 27 386
9 9 387
4 22 388
11 4 389
6 17 390
1 30 391
8 12 392
3 25 393
10 7 394
5 20 395
12 2 396
7 15 397
2 28 398
9 10 399
4 23 400
11 5 401
6 18 402
1 31 403
8 13 404
3 26 405
10 8 406
5 21 407
12 3 408
7 16 409
2 29 410
9 11 411
4 24 412
11 6 413
6 19 414
8 14 416
3 27 417
10 9 418
5 22 419
12 4 420
7 17 421
2 30 422
9 12 423
4 25 424
11 7 425
6 20 426
8 15 428
3 28 429
10 10 430
5 23 431
12 5 432
7 18 433
2 31 434
9 13 435
4 26 436
11 8 437
6 21 438
8 16 440
3 29 441
10 11 442
5 24 443
12 6 444
7 19 445
9 14 447
4 27 448
11 9 449
6 22 450
8 17 452
3 30 453
10 12 454
5 25 455
12 7 456
7 20 457
9 15 459
4 28 460
11 10 461
6 23 462
8 18 464
3 31 465
10 13 466
5 26 467
12 8 468
7 21 469
9 16 471
4 29 472
11 11 473
6 24 474
8 19 476
10 14 478
5 27 479
12 9 480
7 22 481
9 17 483
4 30 484
11 12 485
6 25 486
8 20 488
10 15 490
5 28 491
12 10 492
7 23 493
9 18 495
4 31 496
11 13 497
6 26 498
8 21 500
10 16 502
5 29 503
12 11 504
7 24 505
9 19 507
11 14 509
6 27 510
8 22 512
10 17 514
5 30 515
12 12 516
7 25 517
9 20 519
11 15 521
6 28 522
8 23 524
10 18 526
5 31 527
12 13 528
7 26 529
9 21 531
11 16 533
6 29 534
8 24 536
10 19 538
12 14 540
7 27 541
9 22 543
11 17 545
6 30 546
8 25 548
10 20 550
12 15 552
7 28 553
9 23 555
11 18 557
6 31 558
8 26 560
10 21 562
12 16 564
7 29 565
9 24 567
11 19 569
8 27 572
10 22 574
12 17 576
7 30 577
9 25 579
11 20 581
8 28 584
10 23 586
12 18 588
7 31 589
9 26 591
11 21 593
8 29 596
10 24 598
12 19 600
9 27 603
11 22 605
8 30 608
10 25 610
12 20 612
9 28 615
11 23 617
8 31 620
10 26 622
12 21 624
9 29 627
11 24 629
10 27 634
12 22 636
9 30 639
11 25 641
10 28 646
12 23 648
9 31 651
11 26 653
10 29 658
12 24 660
11 27 665
10 30 670
12 25 672
11 28 677
10 31 682
12 26 684
11 29 689
12 27 696
11 30 701
12 28 708
11 31 713
12 29 720
12 30 732
12 31 744
|
Posted by Charlie
on 2016-08-18 11:05:32 |