RE: HHC 2014 Programming Contest - Joe Horn - 09-28-2014 12:16 AM
(09-27-2014 07:44 PM)Don Shepherd Wrote: I would say Dec 31 to Jan 1 of the following year is out-of-scope and should not be tested.
Actually, it has to be tested for, since a "PDP Date" is defined as any date in a Prime Date Pair, and the program must return all the "PDP Dates" in the given year... even if one of those PDP Dates is Jan 1 or Dec 31. That little complication was an intentional part of this mini-challenge, just for fun.
RE: HHC 2014 Programming Contest - Neil Hamilton - 09-28-2014 11:58 AM
Maybe I am misunderstanding something in the format but it appears that there may be up to 30 entries missing from your table. I get 1057 pairs in the 1583 - 9999 range and you get 1027.
These are the earlier of the 2 dates for the ones that appear to be missing. I hand checked a few (only one shown) to ensure that my program wasn't doing something wacky.
Code:
31.016401 => 64010131 (prime), 64010201 (prime)
31.016422
31.016428
31.016488
31.016527
31.016539
31.016545
31.016548
31.016554
31.016560
31.016581
31.016620
31.016650
31.016653
31.016677
31.036435
31.036549
31.036666
31.036699
31.036768
31.036774
31.036822
31.036831
31.036873
31.037170
31.037209
31.037449
31.037560
31.037608
31.037680
Am I missing something?
Here is my complete list. It took somewhat longer than my estimate to run (10377 s instead of 8400 s) and yielded a few PDPs fewer than my estimate (1057 instead of 1122 +/- 50). Note that, due to the STD formatting on the 50G, the years ending with 0 are truncated -- 0-extend as required.
Code:
# years 1583-9999
31.101586,1.111586
31.081588,1.091588
31.1216,1.011601
31.031608,1.041608
31.011613,1.021613
31.121621,1.011622
31.031629,1.041629
31.031632,1.041632
29.021636,1.031636
31.101652,1.111652
31.071664,1.081664
31.081672,1.091672
31.031674,1.041674
31.081678,1.091678
31.011679,1.021679
31.071679,1.081679
31.101679,1.111679
31.071697,1.081697
31.071706,1.081706
31.101709,1.111709
31.051732,1.061732
31.101733,1.111733
31.121747,1.011748
31.031764,1.041764
31.011769,1.021769
31.011787,1.021787
31.011793,1.021793
31.101793,1.111793
31.071796,1.081796
31.051804,1.061804
31.101805,1.111805
31.12181,1.011811
31.101811,1.111811
31.031824,1.041824
31.121828,1.011829
31.011835,1.021835
31.071841,1.081841
31.071847,1.081847
31.031866,1.041866
31.05187,1.06187
31.051876,1.061876
31.031881,1.041881
31.071886,1.081886
31.121891,1.011892
31.071913,1.081913
31.051921,1.061921
29.021924,1.031924
31.011925,1.021925
31.12193,1.011931
31.03195,1.04195
31.121972,1.011973
31.121978,1.011979
31.011979,1.021979
31.031983,1.041983
31.121987,1.011988
31.08199,1.09199
31.101997,1.111997
31.052002,1.062002
31.082017,1.092017
31.072018,1.082018
31.12202,1.012021
29.022028,1.032028
31.122029,1.01203
31.102036,1.112036
31.032064,1.042064
31.082068,1.092068
31.012075,1.022075
31.05208,1.06208
29.02208,1.03208
31.102081,1.112081
31.072093,1.082093
31.082107,1.092107
31.05211,1.06211
31.052122,1.062122
31.102132,1.112132
31.032136,1.042136
31.012138,1.022138
31.10215,1.11215
31.122161,1.012162
31.012165,1.022165
31.012171,1.022171
31.072204,1.082204
31.032211,1.042211
31.102216,1.112216
31.082242,1.092242
31.052257,1.062257
31.032262,1.042262
31.012264,1.022264
31.082281,1.092281
31.072282,1.082282
31.032289,1.042289
31.08229,1.09229
31.012291,1.022291
31.082302,1.092302
29.022304,1.032304
29.022308,1.032308
31.102312,1.112312
31.072315,1.082315
31.08232,1.09232
31.01233,1.02233
31.052338,1.062338
31.012372,1.022372
31.082374,1.092374
31.122383,1.012384
31.032385,1.042385
31.072396,1.082396
31.082404,1.092404
31.082413,1.092413
31.122413,1.012414
31.102414,1.112414
31.01242,1.02242
31.10242,1.11242
31.052425,1.062425
31.072435,1.082435
31.102435,1.112435
31.122437,1.012438
31.012438,1.022438
31.102444,1.112444
31.082446,1.092446
29.022448,1.032448
31.012456,1.022456
31.052485,1.062485
29.022508,1.032508
31.10251,1.11251
31.032511,1.042511
31.102531,1.112531
31.122533,1.012534
31.032535,1.042535
31.052539,1.062539
31.082539,1.092539
31.07254,1.08254
31.052542,1.062542
31.072561,1.082561
31.10257,1.11257
31.032574,1.042574
31.012576,1.022576
31.122581,1.012582
31.0126,1.0226
31.122602,1.012603
31.082611,1.092611
31.082614,1.092614
31.072615,1.082615
31.082617,1.092617
31.012633,1.022633
31.032634,1.042634
31.12265,1.012651
31.10266,1.11266
31.052674,1.062674
31.05268,1.06268
31.122689,1.01269
31.032706,1.042706
31.052713,1.062713
31.082728,1.092728
31.102729,1.112729
31.052731,1.062731
31.052737,1.062737
31.012765,1.022765
31.122776,1.012777
31.072777,1.082777
31.032781,1.042781
31.072798,1.082798
31.102801,1.112801
31.032802,1.042802
31.032814,1.042814
31.052818,1.062818
31.032829,1.042829
31.102834,1.112834
31.032847,1.042847
31.03285,1.04285
31.102864,1.112864
31.102867,1.112867
31.012876,1.022876
31.052884,1.062884
31.012885,1.022885
31.0129,1.0229
31.072912,1.082912
31.102912,1.112912
31.082926,1.092926
31.102927,1.112927
31.122932,1.012933
31.012933,1.022933
31.03294,1.04294
31.052944,1.062944
31.102945,1.112945
31.072951,1.082951
31.012987,1.022987
31.10299,1.11299
..31.033,1.043
31.073014,1.083014
29.023036,1.033036
31.033039,1.043039
31.013047,1.023047
31.013068,1.023068
31.033072,1.043072
31.083079,1.093079
31.013083,1.023083
31.053085,1.063085
31.123097,1.013098
31.103107,1.113107
31.083109,1.093109
31.033114,1.043114
31.073122,1.083122
29.023124,1.033124
31.073131,1.083131
31.013155,1.023155
31.073155,1.083155
31.033171,1.043171
31.103173,1.113173
31.073176,1.083176
31.033186,1.043186
31.08319,1.09319
31.03321,1.04321
31.073212,1.083212
31.013221,1.023221
31.083223,1.093223
31.053226,1.063226
31.033252,1.043252
31.07326,1.08326
29.023264,1.033264
31.073266,1.083266
31.033267,1.043267
31.053274,1.063274
31.083274,1.093274
31.073278,1.083278
31.033285,1.043285
31.053289,1.063289
31.033297,1.043297
31.123298,1.013299
31.013317,1.023317
31.033327,1.043327
31.083328,1.093328
31.073344,1.083344
31.083346,1.093346
31.033351,1.043351
31.073377,1.083377
31.123379,1.01338
31.053388,1.063388
31.103395,1.113395
31.073398,1.083398
31.103407,1.113407
29.023424,1.033424
31.103428,1.113428
31.08343,1.09343
31.083439,1.093439
31.033441,1.043441
31.10347,1.11347
31.053472,1.063472
31.083475,1.093475
31.03348,1.04348
31.123487,1.013488
31.083508,1.093508
31.053511,1.063511
31.013515,1.023515
31.073521,1.083521
31.123538,1.013539
31.033546,1.043546
31.073554,1.083554
31.033564,1.043564
31.073572,1.083572
31.123574,1.013575
31.103575,1.113575
31.033591,1.043591
31.053598,1.063598
31.073611,1.083611
31.013614,1.023614
31.103632,1.113632
31.033633,1.043633
31.123634,1.013635
31.08364,1.09364
31.033648,1.043648
31.073653,1.083653
31.083661,1.093661
31.08367,1.09367
31.123685,1.013686
31.123688,1.013689
29.023688,1.033688
31.073692,1.083692
31.123694,1.013695
31.07371,1.08371
31.123727,1.013728
31.033747,1.043747
29.023748,1.033748
31.073755,1.083755
31.073758,1.083758
31.053787,1.063787
31.0738,1.0838
31.1038,1.1138
29.023816,1.033816
31.073818,1.083818
29.02382,1.03382
31.033822,1.043822
31.013827,1.023827
31.083853,1.093853
31.033855,1.043855
31.103857,1.113857
31.053862,1.063862
31.053868,1.063868
31.073875,1.083875
31.053877,1.063877
31.083886,1.093886
31.073887,1.083887
31.033894,1.043894
31.103896,1.113896
31.103899,1.113899
31.083901,1.093901
29.023904,1.033904
31.013914,1.023914
31.07392,1.08392
31.013923,1.023923
31.053928,1.063928
31.013929,1.023929
31.103932,1.113932
31.013944,1.023944
31.103995,1.113995
31.124,1.014001
31.074007,1.084007
31.104016,1.114016
31.084024,1.094024
31.074064,1.084064
31.074073,1.084073
31.054084,1.064084
31.104088,1.114088
31.124099,1.0141
31.074118,1.084118
31.054123,1.064123
31.084135,1.094135
31.124141,1.014142
31.05415,1.06415
31.074157,1.084157
31.124162,1.014163
31.084171,1.094171
31.074181,1.084181
31.104181,1.114181
31.124189,1.01419
31.014202,1.024202
31.08421,1.09421
31.01422,1.02422
31.054225,1.064225
31.054231,1.064231
31.084231,1.094231
31.12424,1.014241
31.124246,1.014247
31.124252,1.014253
31.074253,1.084253
31.104262,1.114262
31.014271,1.024271
31.074298,1.084298
31.124306,1.014307
31.07431,1.08431
31.034323,1.044323
31.014328,1.024328
31.104334,1.114334
31.10434,1.11434
31.074349,1.084349
31.014352,1.024352
31.074364,1.084364
31.034365,1.044365
31.034383,1.044383
31.074388,1.084388
31.104394,1.114394
31.054396,1.064396
31.1044,1.1144
31.014409,1.024409
31.054411,1.064411
31.124411,1.014412
31.014415,1.024415
31.054417,1.064417
31.104445,1.114445
31.034449,1.044449
31.054456,1.064456
31.084459,1.094459
29.024464,1.034464
31.034467,1.044467
31.104478,1.114478
31.05448,1.06448
31.104484,1.114484
31.084486,1.094486
31.01449,1.02449
31.034491,1.044491
31.084525,1.094525
31.054528,1.064528
31.084528,1.094528
31.014538,1.024538
31.104559,1.114559
31.084567,1.094567
31.104571,1.114571
31.10458,1.11458
31.054585,1.064585
31.124597,1.014598
31.104598,1.114598
31.034629,1.044629
31.08463,1.09463
31.124642,1.014643
31.074643,1.084643
31.03465,1.04465
31.054663,1.064663
31.054669,1.064669
31.124684,1.014685
31.074685,1.084685
31.054693,1.064693
31.034695,1.044695
31.034701,1.044701
31.034722,1.044722
31.054726,1.064726
31.084732,1.094732
31.034752,1.044752
31.124756,1.014757
31.084765,1.094765
31.104769,1.114769
31.034779,1.044779
31.014781,1.024781
31.01479,1.02479
31.104793,1.114793
31.104796,1.114796
31.104802,1.114802
31.034803,1.044803
31.054807,1.064807
31.124813,1.014814
31.054816,1.064816
31.054834,1.064834
31.034836,1.044836
31.014871,1.024871
31.074871,1.084871
31.054873,1.064873
31.104874,1.114874
31.054876,1.064876
31.034881,1.044881
31.084912,1.094912
31.034914,1.044914
31.084915,1.094915
31.104925,1.114925
31.084927,1.094927
31.104934,1.114934
31.034935,1.044935
29.024936,1.034936
31.054948,1.064948
31.03495,1.04495
31.014979,1.024979
31.12499,1.014991
31.034992,1.044992
31.084996,1.094996
31.124996,1.014997
31.054999,1.064999
..31.015,1.025
31.105003,1.115003
29.025004,1.035004
31.015015,1.025015
29.02502,1.03502
31.125029,1.01503
31.075039,1.085039
31.105039,1.115039
31.055041,1.065041
31.105045,1.115045
31.125053,1.015054
31.035067,1.045067
31.085068,1.095068
31.08508,1.09508
31.035082,1.045082
31.075093,1.085093
31.015096,1.025096
31.125104,1.015105
31.015108,1.025108
31.05511,1.06511
29.025116,1.035116
31.015129,1.025129
31.015132,1.025132
31.075144,1.085144
31.10515,1.11515
31.015153,1.025153
31.085158,1.095158
31.085161,1.095161
29.025196,1.035196
31.035229,1.045229
31.085239,1.095239
29.025244,1.035244
31.075255,1.085255
31.085272,1.095272
31.015273,1.025273
31.075276,1.085276
31.075294,1.085294
31.035298,1.045298
31.055302,1.065302
31.015306,1.025306
31.125326,1.015327
31.015327,1.025327
31.055338,1.065338
31.055359,1.065359
31.085371,1.095371
31.125374,1.015375
31.015375,1.025375
31.015378,1.025378
31.055389,1.065389
31.105396,1.115396
31.075399,1.085399
31.055425,1.065425
31.125428,1.015429
31.105429,1.115429
31.125437,1.015438
31.015441,1.025441
31.085455,1.095455
31.055461,1.065461
31.035469,1.045469
31.085473,1.095473
31.01548,1.02548
31.075483,1.085483
31.105486,1.115486
31.055512,1.065512
31.085524,1.095524
31.015531,1.025531
31.105537,1.115537
31.035541,1.045541
31.125542,1.015543
31.125557,1.015558
29.02556,1.03556
31.01557,1.02557
31.03558,1.04558
31.015582,1.025582
31.085584,1.095584
31.105588,1.115588
31.075603,1.085603
31.035613,1.045613
31.085614,1.095614
29.025616,1.035616
31.105618,1.115618
31.035619,1.045619
31.055635,1.065635
31.075642,1.085642
31.035643,1.045643
31.125647,1.015648
31.08565,1.09565
29.025652,1.035652
31.035655,1.045655
31.035658,1.045658
31.125659,1.01566
29.02568,1.03568
31.105681,1.115681
31.015693,1.025693
31.035709,1.045709
31.125716,1.015717
31.035721,1.045721
31.105726,1.115726
31.075735,1.085735
31.015738,1.025738
31.035745,1.045745
31.085764,1.095764
31.105768,1.115768
31.055776,1.065776
31.055785,1.065785
31.125788,1.015789
31.105804,1.115804
31.125818,1.015819
31.035823,1.045823
31.085839,1.095839
31.01584,1.02584
31.125848,1.015849
31.03585,1.04585
31.085887,1.095887
31.075897,1.085897
31.015909,1.025909
31.075915,1.085915
31.035919,1.045919
31.10593,1.11593
31.125953,1.015954
31.035955,1.045955
31.055956,1.065956
31.055968,1.065968
31.035976,1.045976
31.01599,1.02599
31.085992,1.095992
31.075996,1.085996
31.085998,1.095998
31.036042,1.046042
31.01605,1.02605
31.086058,1.096058
31.086064,1.096064
31.056073,1.066073
31.056082,1.066082
31.106089,1.116089
31.076092,1.086092
31.036099,1.046099
31.056103,1.066103
31.126103,1.016104
31.056112,1.066112
31.076113,1.086113
31.056118,1.066118
29.026124,1.036124
31.076125,1.086125
31.036153,1.046153
31.076158,1.086158
31.076167,1.086167
31.106167,1.116167
31.056181,1.066181
31.126184,1.016185
31.056196,1.066196
31.126196,1.016197
31.016197,1.026197
31.0162,1.0262
31.036201,1.046201
31.016203,1.026203
31.086208,1.096208
31.126208,1.016209
31.086226,1.096226
31.086235,1.096235
31.126235,1.016236
31.106242,1.116242
31.076251,1.086251
31.036255,1.046255
31.076257,1.086257
31.126259,1.01626
31.03627,1.04627
31.036273,1.046273
31.076275,1.086275
31.08628,1.09628
31.106281,1.116281
31.056283,1.066283
31.126298,1.016299
31.016299,1.026299
31.056301,1.066301
31.016314,1.026314
31.016317,1.026317
31.01632,1.02632
31.106326,1.116326
31.056328,1.066328
31.086343,1.096343
31.106353,1.116353
31.086394,1.096394
29.026396,1.036396
31.056397,1.066397
31.016401,1.026401
29.026408,1.036408
31.016422,1.026422
31.086424,1.096424
31.016428,1.026428
31.036435,1.046435
29.026436,1.036436
31.106446,1.116446
31.106452,1.116452
31.076458,1.086458
29.02646,1.03646
31.056475,1.066475
31.076479,1.086479
31.016488,1.026488
31.086526,1.096526
31.016527,1.026527
31.10653,1.11653
31.056532,1.066532
31.126532,1.016533
31.016539,1.026539
31.056541,1.066541
31.126544,1.016545
31.016545,1.026545
31.086547,1.096547
31.016548,1.026548
31.036549,1.046549
31.016554,1.026554
31.01656,1.02656
31.016581,1.026581
31.076599,1.086599
31.056607,1.066607
31.126613,1.016614
31.01662,1.02662
31.086631,1.096631
31.106644,1.116644
31.01665,1.02665
31.016653,1.026653
31.126655,1.016656
31.106656,1.116656
31.056664,1.066664
31.036666,1.046666
31.016677,1.026677
31.056679,1.066679
31.126688,1.016689
31.036699,1.046699
31.076704,1.086704
31.07671,1.08671
31.05673,1.06673
31.076731,1.086731
31.086742,1.096742
31.056754,1.066754
29.02676,1.03676
31.016761,1.026761
31.126763,1.016764
31.036768,1.046768
31.036774,1.046774
31.076803,1.086803
31.076806,1.086806
31.126814,1.016815
31.036822,1.046822
31.086823,1.096823
31.036831,1.046831
31.086838,1.096838
31.076839,1.086839
31.016851,1.026851
31.056853,1.066853
31.126859,1.01686
31.016863,1.026863
31.036873,1.046873
31.076878,1.086878
31.016884,1.026884
31.126892,1.016893
31.016893,1.026893
31.086895,1.096895
31.106899,1.116899
31.086904,1.096904
31.106914,1.116914
31.106917,1.116917
31.07692,1.08692
31.076929,1.086929
31.056937,1.066937
31.12694,1.016941
31.106953,1.116953
31.056979,1.066979
31.076983,1.086983
31.107001,1.117001
31.127003,1.017004
31.077007,1.087007
29.027008,1.037008
31.017022,1.027022
31.057039,1.067039
31.107058,1.117058
31.057063,1.067063
31.12709,1.017091
31.0771,1.0871
31.127102,1.017103
31.057108,1.067108
31.057111,1.067111
31.107118,1.117118
31.05712,1.06712
31.077124,1.087124
31.10713,1.11713
31.107139,1.117139
31.107151,1.117151
31.057153,1.067153
31.107169,1.117169
31.03717,1.04717
31.017175,1.027175
31.057183,1.067183
31.077187,1.087187
31.037209,1.047209
31.077217,1.087217
31.057222,1.067222
31.017223,1.027223
31.077223,1.087223
31.077241,1.087241
31.107247,1.117247
29.027248,1.037248
31.127249,1.01725
31.107253,1.117253
31.127258,1.017259
31.107268,1.117268
31.017274,1.027274
31.017289,1.027289
31.127291,1.017292
31.127297,1.017298
31.08733,1.09733
31.107343,1.117343
31.057354,1.067354
31.087363,1.097363
31.10737,1.11737
31.017373,1.027373
31.057384,1.067384
31.077391,1.087391
31.127405,1.017406
31.107421,1.117421
31.107436,1.117436
31.037449,1.047449
31.08745,1.09745
31.107454,1.117454
31.017457,1.027457
31.107466,1.117466
31.107475,1.117475
31.087483,1.097483
31.077496,1.087496
31.087519,1.097519
31.017523,1.027523
31.107529,1.117529
31.077538,1.087538
31.127552,1.017553
31.087555,1.097555
31.03756,1.04756
31.087561,1.097561
31.107562,1.117562
31.12757,1.017571
31.057585,1.067585
31.077601,1.087601
31.037608,1.047608
31.01761,1.02761
31.10761,1.11761
31.087612,1.097612
31.057624,1.067624
31.127633,1.017634
31.087663,1.097663
31.127663,1.017664
31.057672,1.067672
31.03768,1.04768
31.127684,1.017685
29.027692,1.037692
31.127699,1.0177
31.087717,1.097717
31.08772,1.09772
31.07773,1.08773
31.077733,1.087733
31.107742,1.117742
29.027744,1.037744
31.077766,1.087766
31.087768,1.097768
31.03777,1.04777
31.057789,1.067789
31.01779,1.02779
31.017799,1.027799
31.037803,1.047803
31.037806,1.047806
31.017826,1.027826
31.017832,1.027832
31.057837,1.067837
31.127858,1.017859
31.077859,1.087859
31.037884,1.047884
31.057888,1.067888
31.077892,1.087892
31.127897,1.017898
31.127936,1.017937
31.03795,1.04795
31.127957,1.017958
31.057966,1.067966
31.037968,1.047968
29.027968,1.037968
31.017979,1.027979
31.017982,1.027982
31.107988,1.117988
31.058008,1.068008
31.108012,1.118012
31.018024,1.028024
31.088029,1.098029
31.10803,1.11803
31.088038,1.098038
31.078039,1.088039
31.058041,1.068041
31.128041,1.018042
31.038049,1.048049
29.028052,1.038052
31.038055,1.048055
31.07806,1.08806
31.088065,1.098065
31.058086,1.068086
31.018105,1.028105
31.12811,1.018111
31.038127,1.048127
31.058131,1.068131
31.088149,1.098149
31.038154,1.048154
31.088164,1.098164
31.088191,1.098191
31.128194,1.018195
31.078195,1.088195
31.018198,1.028198
31.078204,1.088204
31.078207,1.088207
31.10821,1.11821
31.058212,1.068212
31.03822,1.04822
31.058233,1.068233
31.128233,1.018234
31.058257,1.068257
31.038262,1.048262
31.088272,1.098272
31.03828,1.04828
31.038283,1.048283
31.088287,1.098287
31.078288,1.088288
31.078294,1.088294
31.078297,1.088297
31.078309,1.088309
31.058317,1.068317
31.108321,1.118321
31.108324,1.118324
31.078327,1.088327
31.108327,1.118327
31.088344,1.098344
31.078375,1.088375
31.108384,1.118384
31.018408,1.028408
31.078435,1.088435
31.12844,1.018441
31.128446,1.018447
31.088455,1.098455
31.128455,1.018456
31.05847,1.06847
31.038478,1.048478
31.108483,1.118483
31.03849,1.04849
31.088494,1.098494
31.058497,1.068497
31.058503,1.068503
31.128503,1.018504
31.078507,1.088507
29.02852,1.03852
31.018528,1.028528
31.018534,1.028534
31.01854,1.02854
31.088545,1.098545
31.05856,1.06856
31.108573,1.118573
31.058578,1.068578
31.058581,1.068581
31.128587,1.018588
31.038589,1.048589
31.018594,1.028594
31.078594,1.088594
31.088599,1.098599
31.078606,1.088606
31.128611,1.018612
31.078621,1.088621
31.078642,1.088642
31.128653,1.018654
31.128656,1.018657
31.018657,1.028657
31.058659,1.068659
31.01866,1.02866
31.088665,1.098665
31.078675,1.088675
31.128686,1.018687
31.038694,1.048694
31.058743,1.068743
31.01875,1.02875
31.10875,1.11875
31.128755,1.018756
31.058758,1.068758
31.018765,1.028765
31.038769,1.048769
31.078783,1.088783
31.108789,1.118789
31.018807,1.028807
31.018813,1.028813
31.078819,1.088819
31.108819,1.118819
31.038862,1.048862
31.058866,1.068866
31.128875,1.018876
31.088881,1.098881
31.088884,1.098884
29.028892,1.038892
31.088905,1.098905
31.078906,1.088906
31.078909,1.088909
31.088932,1.098932
31.058935,1.068935
31.078936,1.088936
31.108948,1.118948
31.038967,1.048967
29.028968,1.038968
31.058977,1.068977
31.108978,1.118978
31.038985,1.048985
31.128989,1.01899
..31.039,1.049
31.129001,1.019002
31.019005,1.029005
31.039009,1.049009
31.019014,1.029014
31.129031,1.019032
31.019035,1.029035
31.019068,1.029068
31.089082,1.099082
31.109092,1.119092
31.089094,1.099094
31.019122,1.029122
31.109137,1.119137
31.059139,1.069139
31.089145,1.099145
31.109146,1.119146
31.019155,1.029155
31.079179,1.089179
31.079194,1.089194
31.039204,1.049204
31.019218,1.029218
31.129244,1.019245
31.039249,1.049249
31.079263,1.089263
31.019275,1.029275
31.10929,1.11929
31.089301,1.099301
31.129304,1.019305
31.08931,1.09931
31.089313,1.099313
31.129313,1.019314
31.109323,1.119323
31.079326,1.089326
31.059328,1.069328
31.03933,1.04933
31.019344,1.029344
31.05937,1.06937
31.059373,1.069373
31.109392,1.119392
31.109395,1.119395
31.089397,1.099397
31.059415,1.069415
31.019431,1.029431
31.109431,1.119431
31.039435,1.049435
31.039447,1.049447
31.089451,1.099451
31.109464,1.119464
31.079467,1.089467
31.079482,1.089482
31.08949,1.09949
31.039519,1.049519
29.029532,1.039532
31.079536,1.089536
31.089547,1.099547
31.129547,1.019548
31.109548,1.119548
31.059559,1.069559
31.109566,1.119566
31.019575,1.029575
31.059577,1.069577
31.089625,1.099625
31.059637,1.069637
31.089658,1.099658
31.019662,1.029662
31.129673,1.019674
31.039693,1.049693
31.059694,1.069694
29.029696,1.039696
31.0897,1.0997
31.019701,1.029701
31.019731,1.029731
31.03975,1.04975
31.08976,1.09976
31.039765,1.049765
31.129766,1.019767
31.01977,1.02977
31.019773,1.029773
31.03978,1.04978
31.019812,1.029812
31.129817,1.019818
31.01983,1.02983
31.059832,1.069832
31.079833,1.089833
31.089838,1.099838
31.089841,1.099841
31.039843,1.049843
31.12985,1.019851
31.019851,1.029851
31.039864,1.049864
31.059868,1.069868
31.079872,1.089872
31.039876,1.049876
31.109884,1.119884
31.059889,1.069889
31.059913,1.069913
31.089925,1.099925
31.079956,1.089956
31.079959,1.089959
31.019968,1.029968
31.129976,1.019977
31.059997,1.069997
I used a crappy little Perl script to reformat both data sets and run the comparision:
Code:
#!/usr/bin/perl -w
#use strict;
my $message = "Compare my PDP output to Joe's.";
my $dump_joes = 0;
my $joes_dump_file = "joes_in_my_format.txt";
my $outfile = "-";
my $joes = "-";
my $mine = "-";
my $script_executable = $0;
my $script_name = "";
if ($script_executable =~ /[\.\/]*(\w+\.pl)/) {
$script_name = "$1";
}
# ---------------------------------------------------------------------
my $script = <<SCRIPT;
$script_name - $message
SCRIPT
my $usage = <<EOM;
$script
Usage:
$script_name -j JOES_FILE -m MY_FILE [-dj] [-o outfile]
Parameters:
-j Joe's List Cut-and-paste of Joe's list from forum.
-m My List Recovered struture from HP50G memory card.
-dj Dump Joe's data in a format closer to mine.
-o outfile Output file. Uses STDOUT if not given.
-h This help script.
Examples:
\$ $script_name -j joes.txt -m pdp.txt -dj
- Read in Joe's data and my data. Parse the 2 and compare entires
in both directions; mine in his and his in mine.
EOM
#######################################################################
get_options();
open OUT, "> $outfile" or die "ERROR: Cannot open file '$outfile' for writing: $!\n";
my %joes = %{read_joes($joes)};
my %mine = %{read_mine($mine)};
for my $date (sort keys %joes) {
if (not exists $mine{$date}) {
printf OUT "Date in Joe's but not mine: %0s\n", $date;
}
}
for my $date (sort keys %mine) {
if (not exists $joes{$date}) {
printf OUT "Date in mine but not Joe's: %0s\n", $date;
}
}
close OUT;
#######################################################################
#
sub read_mine {
my $file = shift;
my (%mine);
local $_;
open IN, $file or die "ERROR: Cannot open file '$file' for reading: $!\n";
while (<IN>) {
next if /^\s*$/ or /^\s*#/;
chomp; chomp;
if (/(\d+)\.(\d+)/) {
my $day = $1;
my $month_year = "$2";
# Zero fill any 'short' years
while (length $month_year < 6) {
$month_year .= "0";
}
$date_format = sprintf "%02d.%0s", $day, $month_year;
if (not exists $mine{$date_format}) {
$mine{$date_format} = "$day, $month_year"; # Content does not matter, just key.
} else {
print OUT "# Duplicate found at %0d, %0s\n", $day, $month_year;
}
}
}
close IN;
if ($dump_joes) {
open JOES, "> $joes_dump_file" or die "ERROR: Cannot open file '$joes_dump_file' for writing: $!\n";
for my $date (sort keys %joes) {
printf JOES "%0s\n", $date;
}
close JOES;
}
return \%mine;
} # read_mine
#######################################################################
#
sub read_joes {
my $file = shift;
my (%joes);
local $_;
open IN, $file or die "ERROR: Cannot open file '$file' for reading: $!\n";
my ($month_key);
while (<IN>) {
next if /^\s*$/;
chomp; chomp;
if (/(\w{3}\/\w{3})/) {
$month_key = $1;
} elsif (/\d+/) {
my @years = split /\s+/, $_;
# If this is the Dec/Jan region, we have duplicate/consecutive years.
# Decimate this to only show the first year.
if ($month_key eq "Dec/Jan") {
my (@decimated_years);
for (my $k = 0; $k < scalar @years; $k += 2) {
push @decimated_years, $years[$k];
}
@years = @decimated_years;
}
foreach my $year (@years) {
$date_format = build_date_from_joes($year, $month_key);
if (not exists $joes{$date_format}) {
$joes{$date_format} = "$year, $month_key"; # Content does not matter, just key.
} else {
print OUT "# Duplicate found at %0d, %0s\n", $year, $month_key;
}
}
}
}
close IN;
return \%joes;
} # read_joes
#######################################################################
#
#
#
sub build_date_from_joes {
my $year = shift;
my $month_key = shift;
my ($date);
local $_;
my %months = (Jan => 1,
Feb => 2,
Mar => 3,
May => 5,
Jul => 7,
Aug => 8,
Oct => 10,
Dec => 12);
if ($month_key =~ /^Feb/) {
$date = "29.02" . sprintf "%4d", $year;
} elsif ($month_key =~ /^(\w{3})\//) {
$date = "31." . sprintf "%02d%04d", $months{$1}, $year;
} else {
die "# ERROR: Invalid month key-code: $month_key\n";
}
return $date;
} # build_date_from_joes
#######################################################################
#######################################################################
#
# Process the command line option list.
#
sub get_options {
while (my $arg = shift(@ARGV)) {
# See if help is asked for
if (($arg eq '-h') or ($arg eq '--help')) {
print "$usage\n";
die "\n";
}
elsif ($arg eq '-j') {
$joes = shift(@ARGV);
}
elsif ($arg eq '-m') {
$mine = shift(@ARGV);
}
elsif ($arg eq '-dj') {
$dump_joes = 1;
}
elsif ($arg eq '-o') {
$outfile = shift(@ARGV);
}
}
###############################################
# Check sanity of command line parameters, etc.
unless ($joes and $mine) {
die "ERROR: Not enough files. Use '-j joes.file -m my.file''\n";
}
return;
} # get_options
RE: HHC 2014 Programming Contest - David Hayden - 09-28-2014 01:39 PM
(09-27-2014 04:47 PM)Neil Hamilton Wrote: I gave this a shot in RPL. First attempt yielded 70 s/yr on a 49G+, not too good. This scanned EVERY day of the year (some twice!). Fairly brain dead...
The criteria for the contest was for size only. Runtime didn't matter. My winning entry also scanned every date in the year plus 12/31 of the previous year and 1/1 of the next. It was slower than a turtle going uphill but that didn't matter. I'll post it when I have some time and the source code nearby.
Dave
RE: HHC 2014 Programming Contest - Neil Hamilton - 09-29-2014 11:13 AM
(09-28-2014 01:39 PM)David Hayden Wrote: The criteria for the contest was for size only.
Actually it did have a few more constraints, "all programs must return the correct answers to qualify" among them.
I cannot hope to compete with the Gods of HP Calculators in terms of size or speed. I am nowhere near talented enough. :-)
My only goal was to run through ALL the years and see what I got. For that, 70 s/yr -- or even 23 s/yr -- was not going to cut it. That is the main reason I was looking to pick up the speed.
Having built a program that was suffiently quick (< 1 s/yr for a small range of years), and having obtained the definitive list, I was a bit surprised that my list was longer than the the definitive one. That is my biggest puzzle right now.
I am also wondering why the performance dropped to ~1.25 s/yr when run against a set with an ~8400 year span. The only thing I can think of is that since I push my answers to the stack and with 1000-odd entries on the stack, that might be slowing it down. My output was a string per PDP something like this "31.016401, 1.026401" -- not very compact. Any thoughts?
RE: HHC 2014 Programming Contest - David Hayden - 09-29-2014 11:35 AM
(09-29-2014 11:13 AM)Neil Hamilton Wrote: I am also wondering why the performance dropped to ~1.25 s/yr when run against a set with an ~8400 year span. The only thing I can think of is that since I push my answers to the stack and with 1000-odd entries on the stack, that might be slowing it down.
The large date span probably means that the calculator would do garbage collection at least one, and the items on the large number of items on the stack would make it slow. On the other hand, putting the items in a list would probably be even worse. When you add to a list, it actually creates a new list and copies the old and new items into it. Adding the 877th item copies 866 items, and the new one. So that would probably be even slower. Try dropping the items into a pre-sized array.
RE: HHC 2014 Programming Contest - Joe Horn - 09-29-2014 12:43 PM
(09-28-2014 11:58 AM)Neil Hamilton Wrote: Maybe I am misunderstanding something in the format but it appears that there may be up to 30 entries missing from your table. I get 1057 pairs in the 1583 - 9999 range and you get 1027. ... Am I missing something?
(09-29-2014 11:13 AM)Neil Hamilton Wrote: Having built a program that was suffiently quick (< 1 s/yr for a small range of years), and having obtained the definitive list, I was a bit surprised that my list was longer than the the definitive one. That is my biggest puzzle right now.
Bill Butler solved this "puzzle" -- I must've accidentally missed a block when I copied & pasted from the UBASIC output. The additional PDP's you found are absolutely correct, and I'll edit them into the "complete list" (hah!) ASAP. Thankfully none of those years were used as test cases for judging the contest. Many thanks for catching the missing PDP's!
RE: HHC 2014 Programming Contest - Jeff O. - 09-29-2014 01:41 PM
(09-29-2014 12:43 PM)Joe Horn Wrote: Thankfully none of those years were used as test cases for judging the contest.
What were the test cases used for judging?
RE: HHC 2014 Programming Contest - Thomas Klemm - 09-29-2014 04:57 PM
(09-28-2014 11:58 AM)Neil Hamilton Wrote:
ಠ_ಠ
RE: HHC 2014 Programming Contest - Neil Hamilton - 09-29-2014 05:27 PM
(09-29-2014 04:57 PM)Thomas Klemm Wrote: (09-28-2014 11:58 AM)Neil Hamilton Wrote:
ಠ_ಠ
Good eyes, Thomas! OK, I cheated a little bit! The Perl I have on my computer has the majorly annoying feature of sometimes displaying syntax errors as if they were occuring somewhere deep in the bowels of some standard packages rather than showing me where the issue really is -- in my code. I sometimes start to build a script with this turned off and switch it on later. Forgot this time...
Put 'my' in front of "$date_format" on lines 95 and 145 (as per my current version) and remove the comment on 'strict' and you are off to the races...
The "Joe" file is simply a cut-and-paste of his earlier list. The "Mine" file can be the list I published.
Command line could be:
Code:
$ perl whatever_you_called_this_script.pl -j joes.txt -m pdp3.txt
Date in mine but not Joe's: 31.016401
Date in mine but not Joe's: 31.016422
...
Joe, I suspected that it was simply a few lines were deleted from the output. A cut-and-paste issue makes perfect sense.
RE: HHC 2014 Programming Contest - Joe Horn - 09-30-2014 01:20 AM
(09-29-2014 01:41 PM)Jeff O. Wrote: (09-29-2014 12:43 PM)Joe Horn Wrote: Thankfully none of those years were used as test cases for judging the contest.
What were the test cases used for judging?
Rats... I seem to have discarded the piece of note paper that the test dates (and expected results) were scribbled on. But I know that none of the missing years were used because I only used years that were in my incomplete table. If I ever find that piece of paper, I'll post the years.
EDIT: OOH OOH, I found it! (Doing so caused an avalanche in my room, but I digress). Here are the test years and their expected results:
1586: Oct 31, Nov 1
1588: Aug 31, Sep 1
2014: No PDP's
2020: Dec 31
2021: Jan 1
2080: Feb 29, Mar 1, May 31, Jun 1
2413: Aug 31, Sep 1, Dec 31
2414: Jan 1, Oct 31, Nov 1
3688: Feb 29, Mar 1, Dec 31
7968: Feb 29, Mar 1, Mar 31, Apr 1
RE: HHC 2014 Programming Contest - Jeff O. - 09-30-2014 04:39 PM
(09-30-2014 01:20 AM)Joe Horn Wrote: EDIT: OOH OOH, I found it! (Doing so caused an avalanche in my room, but I digress).
Thanks for the information. (Sorry about the avalanche.)
I developed a couple of wp34s versions based on a couple of methods to attack the problem. Happily, they both produce the correct results for the test cases and all other years I have tried from the complete list. One version is 83 steps and reasonably fast. (If the year has no PPDs it finishes in about 1.5 seconds. If there are PPDs, they are displayed sequentially during pauses, so execution time is extended by the pause time for each date.) Second version is 50 steps, but it is much, much slower than the first version, taking about 20 seconds for years with no PPDs. Scanning through the above posts without reading in detail (to avoid hints or ideas), I see that Eric's version is 50 steps and Paul's is only 44. I doubt that my slooowww 50-stepper is comparable to those, so I think I have a ways to go. Guess I’ll keep messing around for a while (for the fun it - which is the point, right?) to see if I can come up with a better way.
RE: HHC 2014 Programming Contest - BruceH - 10-02-2014 09:35 PM
(09-24-2014 09:31 AM)Paul Dale Wrote: I haven't checked all the myriad of Julian to Gregorian calendar changeovers over the years to see if any of these produced three odd days in a row or not and, if there are some, checked them for primality.
This is obviously possible and should be checked. However, I rather doubt the contest was meant to involve such nastinesses.
In 2011, Samoa skipped a day to jump from behind the International Date Line to be ahead of it (so as to be on the same date as their major trading partners). They did this by skipping December 30th, meaning they had three odd days in a row: 29th then 31st December 2011, followed by 1st January 2012. Fortunately for this competition, none of those dates are prime. :-)
RE: HHC 2014 Programming Contest - Werner - 10-03-2014 07:35 AM
My attempt.
Independent of the date settings, and will run on a 48G or newer.
Maybe the elegance and efficiency will make the judges gasp in awe. One can always hope ;-)
Code:
\<<
\-> Y
\<<
@ list of cases to test.
@ first object is the month number:
@ -last test case is month 1 of the next year, and if you construct yyyymm01 as (y*100 + m)*100 +1 then m=101 will do the trick
@ -the first case reverses the dates so that the correct date will be dropped in case of PDP
@ here, y*1e4 + m*100 + 1 = (y-1)*1e4 + 1231, and the m works out to be -87.7 ;-)
@ second is the difference between the first day of the month and the last of the previous month
@ third ob is the nr of objects to drop in case of a PDP (1 for the first and last case)
{ {-87.7 -8870 1} {2 70 0} }
IF Y LEAP? THEN { { 3 72 0 } } + END
{ {4 70 0} {6 70 0} {8 70 0} {9 70 0} {11 70 0} {101 8870 1} } +
1
\<<
EVAL \-> m d n
\<<
@ construct yyyymm01
Y 100 * m + 100 * 1 +
IF DUP ISPRIME? THEN
@ substract d to get the day before
DUP d - SWAP
OVER ISPRIME? n 2 IFTE DROPN
ELSE DROP
END
\>>
\>>
DOLIST
\>>
\>>
@ without the local environment..
\<<
\-> Y
\<<
{ {1 -8870 -87.7 } {0 70 2} }
IF Y LEAP? THEN { { 0 72 3 } } + END
{ {0 70 4} {0 70 6} {0 70 8} {0 70 9} {0 70 11} {1 8870 101} } +
1
\<< EVAL
@ construct yyyymm01
Y 100 * + 100 * 1 +
IF DUP ISPRIME? THEN
@ get the day before
DUP ROT - SWAP
OVER ISPRIME? 4 ROLL 2 IFTE
ELSE 3
END
DROPN
\>>
DOLIST
\>>
\>>
ISPRIME?
@ Courtesy of John H. Meyers
\<<
{ DUP2 MOD NOT { DUP2 > { DROP2 -1 2 } IFT } IFT }
\-> p
\<< 1 MAX 2 p EVAL 1 + p EVAL 2 + p EVAL 2 +
WHILE DUP2 SQ \>= REPEAT
p EVAL 4 + p EVAL 2 + p EVAL 4 + p EVAL
2 + p EVAL 4 + p EVAL 6 + p EVAL 2 + p EVAL 6 +
END DROP 1 >
\>>
\>>
LEAP?
@ Courtesy of Christian Meland
\<< 4 2 ALOG DUP2 * 3 ->LIST MOD EVAL XOR SAME \>>
Cheers, Werner
RE: HHC 2014 Programming Contest - C.Ret - 10-05-2014 10:02 AM
The version proposed by Werner inspires me and I produce the following codes on my poor HP-28S.
Code:
HHC2014:
« { -8769 131 228 331 430 531 630 731 831 930 1031 1130 1231 }
IF OVER LEAP? THEN 3 229 PUT END
SWAP 1E4 * → Lst y0
« { } y0 1 +
1 13 FOR i
i 13 < 100 8900 IFTE +
IF y0 Lst i GET + PRIME?
THEN IF DUP PRIME? THEN SWAP OVER + SWAP END END
NEXT DROP » »
The last DROP instruction is facultative; it's only clean up stack to only return the list of PDP.
As there is no native ISPRIME?, ISLEAP? or calendar functions on HP28S/C, I have to propose one homebrew version:
Code:
LEAP?:
« DUP 4 MOD
OVER 100 MOD NOT
ROT 400 MOD AND OR NOT »
This Leap Year tester is directly inspired from the version published by Werner/Christian Meland (but adapted to HP28S/C specific environment)
Code:
PRIME?:
« → p
« 2 WHILE DUP SQ p ≤ 1 FC? AND
REPEAT
IF p OVER MOD
THEN NXTODD
ELSE 1 SF END END
SIGN FC?C » »
Of course, the following propose PRIME? is not really fast. A better strategy has to be adopted here to reduce time need for testing as large integer as 20141231 or 99991231.
But this may be the subject of another MPO challenge that will spare batteries!
Code:
NXTODD:
« DUP 2 MOD + 1 + »
Please note that NXTODD is store as an independent program to facilitate reading (and a potential evolution of the code). It may advantageously change into any NEXTPRIME function.
Also, flag 1 have to be clear before the first use of PRIME? (this spare a 1 CF at the beginning of the program) But have any importance only at first use, since the last instruction clear flag 1 whatever the result (cf. FC?C )
RE: HHC 2014 Programming Contest - Werner - 10-05-2014 08:02 PM
JHM's routine should work if you replace the IFTs by their IF THEN END counterparts:
(untested)
Code:
\<<
\<< IF DUP2 MOD NOT THEN
IF DUP2 > THEN DROP2 -1 2 END
END
\>>
\-> p
\<< 1 MAX 2 p EVAL 1 + p EVAL 2 + p EVAL 2 +
WHILE DUP2 SQ \>= REPEAT
p EVAL 4 + p EVAL 2 + p EVAL 4 + p EVAL
2 + p EVAL 4 + p EVAL 6 + p EVAL 2 + p EVAL 6 +
END DROP 1 >
\>>
\>>
Remark that I changed the ultimate test to 1 >
This way it will work for 0 and 1, too. I edited my previous post as well.
Or else, my own simple concoction.
Code:
\<<
1 MAX 2
IF DUP2 MOD THEN 1 +
IF DUP2 MOD THEN 2 +
IF DUP2 MOD THEN 2 +
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
WHILE DUP2 SQ \>= REPEAT
IF DUP2 MOD THEN 4 +
IF DUP2 MOD THEN 2 +
IF DUP2 MOD THEN 4 +
IF DUP2 MOD THEN 2 +
IF DUP2 MOD THEN 4 +
IF DUP2 MOD THEN 6 +
IF DUP2 MOD THEN 2 +
IF DUP2 MOD THEN 6 +
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
ELSE SWAP END
END
\>=
\>>
Yet, to speed up the PDP routine, consider the following:
If yyyymm01 is prime and the day before isn't, then we have performed a lengthy primality testing for nothing.
What we should have is a routine BOTHPRIME? that tests two numbers for divisibility by ever increasing factors at the same time - If both are prime, that will gain us nothing, but if one or both are not, then we will gain a lot of time. I think.
How many times does it happen that yyyymm01 is prime and the day before isn't?
To be continued..
Werner
RE: HHC 2014 Programming Contest - Jeff O. - 10-06-2014 05:01 PM
Discussion about the 2014 contest seems to have waned a bit, but I'll go ahead and post an update on my progress. I was able to shorten my slow version to 44 steps. I had a slightly faster version at 50 steps. My reasonably fast version was stuck at 83 steps and I did not see any opportunities to improve that by much. I was not particularly satisfied with the shorter versions due to the speed, or the longer version based on length, so I kept on trying to come up with new approaches, thought of one, and developed it. (No earth-shaking insights I'm sure, just different than previous attempts.) I was able to develop a 44 step program that seems as fast as my 83 step version. There may be opportunities to shave a few steps off of that, but I think I'm pretty satisfied at this point. In case anyone is interested, here it is:
Code:
YYYY is input year
YYYx is year before input year
YYYz is year after input year
YYY? is indeterminate, could be YYYY, YYYx or YYYz, depending on the situation
calculator must be in yyyy.mmdd date mode
Operation - key in the year you wish to check for Prime Pair Dates, press XEQ 'PPD'.
Program will display any prime pair dates in that year in chronological order. When
done, it will display the input year. (Ignore any values in the Y display if you have
Y display on.)
001 LBL 'PPD' Label "Prime Pair Dates"
002 STO 03 Store input year in register 3
003 SDL 004 multiply by 10000
004 INC X add 1 to YYYY0000, now have YYYY0001
005 SDR 002 divide by 100 to get in form to allow month to be incremented
006 STO 01 store YYYY00.01 in reg 1
007 #11 enter constant 11
008 STO 04 store 11 in loop counter
009 XEQ 01 check YYYx.1231/YYYY0101, YYYY0131/0201…YYYY1031/1101*
010 DSE 04 decrement counter
011 BACK 002 go back to check next date pair
012 #89 when done checking through 1031/1101, enter constant 89
013 STO+ 01 add 89 to YYYY11.01 to get YYYz00.01
014 XEQ 01 check YYYY.1231/YYYz0101
015 RCL 03 recall input year to display when complete
016 STOP
017 LBL 01 subroutine to check date pairs for prime
018 INC 01 increment month
019 RCL 01 recall first of month date
020 SDL 02 multiply by 100 to get in proper form
021 PRIME? is first of month date prime?
022 SKIP 001 if prime, skip to check last of previous month
023 RTN if not prime, return to get next month
024 SDR 004 divide by 10,000 to get in form to allow date arithmetic
025 1 enter 1
026 +/- enter -1
027 DAYS+ subtract 1 day from 1st of month to get last of previous month
028 SDL 004 multiply by 10000 to get in proper form
029 PRIME? is last of prior month date prime?
030 SKIP 001 if prime, skip to display prime date(s)
031 RTN if not prime, return to get next month
032 RCL 01 recall first of month date
033 SDL 002 multiply by 100 to get in proper form for display
034 <>YYXX re-order stack for display in chronological order
035 XEQ 02 execute display subroutine
036 <>TTTT re-order stack to display second date
037 LBL 02 subroutine to display prime date(s)
038 SDR 004 divide year by 10000
039 IP take integer portion to get year value YYY?
040 x=/=? 03 compare YYY? to input year
041 SKIP 002 if not equal, do not display prime date, it is in wrong year
042 <>YYTT re-order stack to display date
043 PSE 25 pause to display prime date
044 RTN
* - 1130 and 1201 can not be a prime pair, so stop after checking 1031/1101 prior
to checking 1231. This program does check other non-possible prime pairs, e.g.
430/501, 630/701 up to that point. This beats checking all days of the year :-)
For the heck of it, I converted Neil's listing of prime date pairs to a list of years with at least one PPD and all PPDs in each such year. There are 1121 years between 1583 and 9999 which have at least one Prime Pair Date (i.e. half of a prime date pair). 218 years have one PPD, 839 have two PPDs, 40 have three PPDs, 23 have four PPDs, none have five PPDs, and one year has the maximum of 6 PPDs, that year being 1679. That totals 2114 individual dates that are one-half of a prime pair, which agrees with Neil's total of 1057 prime pairs. The most common prime pair dates are 31-Jan and 01-Feb, occurring 153 times. The others occur with the following frequency:
31-Dec/01-Jan: 129 occurrences
31-Jan/01-Feb: 153 occurrences
29-Feb/01-Mar: 45 occurrences
31-Mar/01-Apr: 151 occurrences
31-May/01-Jun: 146 occurrences
31-Jul/01-Aug: 149 occurrences
31-Aug/01-Sep: 138 occurrences
31-Oct/01-Nov: 146 occurrences
1-Jan and 31-Dec never occur in the same year.
Here's the complete list:
Code:
1586 31-Oct, 01-Nov
1588 31-Aug, 01-Sep
1600 31-Dec
1601 01-Jan
1608 31-Mar, 01-Apr
1613 31-Jan, 01-Feb
1621 31-Dec
1622 01-Jan
1629 31-Mar, 01-Apr
1632 31-Mar, 01-Apr
1636 29-Feb, 01-Mar
1652 31-Oct, 01-Nov
1664 31-Jul, 01-Aug
1672 31-Aug, 01-Sep
1674 31-Mar, 01-Apr
1678 31-Aug, 01-Sep
1679 31-Jan, 01-Feb, 31-Jul, 01-Aug, 31-Oct, 01-Nov
1697 31-Jul, 01-Aug
1706 31-Jul, 01-Aug
1709 31-Oct, 01-Nov
1732 31-May, 01-Jun
1733 31-Oct, 01-Nov
1747 31-Dec
1748 01-Jan
1764 31-Mar, 01-Apr
1769 31-Jan, 01-Feb
1787 31-Jan, 01-Feb
1793 31-Jan, 01-Feb, 31-Oct, 01-Nov
1796 31-Jul, 01-Aug
1804 31-May, 01-Jun
1805 31-Oct, 01-Nov
1810 31-Dec
1811 01-Jan, 31-Oct, 01-Nov
1824 31-Mar, 01-Apr
1828 31-Dec
1829 01-Jan
1835 31-Jan, 01-Feb
1841 31-Jul, 01-Aug
1847 31-Jul, 01-Aug
1866 31-Mar, 01-Apr
1870 31-May, 01-Jun
1876 31-May, 01-Jun
1881 31-Mar, 01-Apr
1886 31-Jul, 01-Aug
1891 31-Dec
1892 01-Jan
1913 31-Jul, 01-Aug
1921 31-May, 01-Jun
1924 29-Feb, 01-Mar
1925 31-Jan, 01-Feb
1930 31-Dec
1931 01-Jan
1950 31-Mar, 01-Apr
1972 31-Dec
1973 01-Jan
1978 31-Dec
1979 01-Jan, 31-Jan, 01-Feb
1983 31-Mar, 01-Apr
1987 31-Dec
1988 01-Jan
1990 31-Aug, 01-Sep
1997 31-Oct, 01-Nov
2002 31-May, 01-Jun
2017 31-Aug, 01-Sep
2018 31-Jul, 01-Aug
2020 31-Dec
2021 01-Jan
2028 29-Feb, 01-Mar
2029 31-Dec
2030 01-Jan
2036 31-Oct, 01-Nov
2064 31-Mar, 01-Apr
2068 31-Aug, 01-Sep
2075 31-Jan, 01-Feb
2080 29-Feb, 01-Mar, 31-May, 01-Jun
2081 31-Oct, 01-Nov
2093 31-Jul, 01-Aug
2107 31-Aug, 01-Sep
2110 31-May, 01-Jun
2122 31-May, 01-Jun
2132 31-Oct, 01-Nov
2136 31-Mar, 01-Apr
2138 31-Jan, 01-Feb
2150 31-Oct, 01-Nov
2161 31-Dec
2162 01-Jan
2165 31-Jan, 01-Feb
2171 31-Jan, 01-Feb
2204 31-Jul, 01-Aug
2211 31-Mar, 01-Apr
2216 31-Oct, 01-Nov
2242 31-Aug, 01-Sep
2257 31-May, 01-Jun
2262 31-Mar, 01-Apr
2264 31-Jan, 01-Feb
2281 31-Aug, 01-Sep
2282 31-Jul, 01-Aug
2289 31-Mar, 01-Apr
2290 31-Aug, 01-Sep
2291 31-Jan, 01-Feb
2302 31-Aug, 01-Sep
2304 29-Feb, 01-Mar
2308 29-Feb, 01-Mar
2312 31-Oct, 01-Nov
2315 31-Jul, 01-Aug
2320 31-Aug, 01-Sep
2330 31-Jan, 01-Feb
2338 31-May, 01-Jun
2372 31-Jan, 01-Feb
2374 31-Aug, 01-Sep
2383 31-Dec
2384 01-Jan
2385 31-Mar, 01-Apr
2396 31-Jul, 01-Aug
2404 31-Aug, 01-Sep
2413 31-Aug, 01-Sep, 31-Dec
2414 01-Jan, 31-Oct, 01-Nov
2420 31-Jan, 01-Feb, 31-Oct, 01-Nov
2425 31-May, 01-Jun
2435 31-Jul, 01-Aug, 31-Oct, 01-Nov
2437 31-Dec
2438 01-Jan, 31-Jan, 01-Feb
2444 31-Oct, 01-Nov
2446 31-Aug, 01-Sep
2448 29-Feb, 01-Mar
2456 31-Jan, 01-Feb
2485 31-May, 01-Jun
2508 29-Feb, 01-Mar
2510 31-Oct, 01-Nov
2511 31-Mar, 01-Apr
2531 31-Oct, 01-Nov
2533 31-Dec
2534 01-Jan
2535 31-Mar, 01-Apr
2539 31-May, 01-Jun, 31-Aug, 01-Sep
2540 31-Jul, 01-Aug
2542 31-May, 01-Jun
2561 31-Jul, 01-Aug
2570 31-Oct, 01-Nov
2574 31-Mar, 01-Apr
2576 31-Jan, 01-Feb
2581 31-Dec
2582 01-Jan
2600 31-Jan, 01-Feb
2602 31-Dec
2603 01-Jan
2611 31-Aug, 01-Sep
2614 31-Aug, 01-Sep
2615 31-Jul, 01-Aug
2617 31-Aug, 01-Sep
2633 31-Jan, 01-Feb
2634 31-Mar, 01-Apr
2650 31-Dec
2651 01-Jan
2660 31-Oct, 01-Nov
2674 31-May, 01-Jun
2680 31-May, 01-Jun
2689 31-Dec
2690 01-Jan
2706 31-Mar, 01-Apr
2713 31-May, 01-Jun
2728 31-Aug, 01-Sep
2729 31-Oct, 01-Nov
2731 31-May, 01-Jun
2737 31-May, 01-Jun
2765 31-Jan, 01-Feb
2776 31-Dec
2777 01-Jan, 31-Jul, 01-Aug
2781 31-Mar, 01-Apr
2798 31-Jul, 01-Aug
2801 31-Oct, 01-Nov
2802 31-Mar, 01-Apr
2814 31-Mar, 01-Apr
2818 31-May, 01-Jun
2829 31-Mar, 01-Apr
2834 31-Oct, 01-Nov
2847 31-Mar, 01-Apr
2850 31-Mar, 01-Apr
2864 31-Oct, 01-Nov
2867 31-Oct, 01-Nov
2876 31-Jan, 01-Feb
2884 31-May, 01-Jun
2885 31-Jan, 01-Feb
2900 31-Jan, 01-Feb
2912 31-Jul, 01-Aug, 31-Oct, 01-Nov
2926 31-Aug, 01-Sep
2927 31-Oct, 01-Nov
2932 31-Dec
2933 01-Jan, 31-Jan, 01-Feb
2940 31-Mar, 01-Apr
2944 31-May, 01-Jun
2945 31-Oct, 01-Nov
2951 31-Jul, 01-Aug
2987 31-Jan, 01-Feb
2990 31-Oct, 01-Nov
3000 31-Mar, 01-Apr
3014 31-Jul, 01-Aug
3036 29-Feb, 01-Mar
3039 31-Mar, 01-Apr
3047 31-Jan, 01-Feb
3068 31-Jan, 01-Feb
3072 31-Mar, 01-Apr
3079 31-Aug, 01-Sep
3083 31-Jan, 01-Feb
3085 31-May, 01-Jun
3097 31-Dec
3098 01-Jan
3107 31-Oct, 01-Nov
3109 31-Aug, 01-Sep
3114 31-Mar, 01-Apr
3122 31-Jul, 01-Aug
3124 29-Feb, 01-Mar
3131 31-Jul, 01-Aug
3155 31-Jan, 01-Feb, 31-Jul, 01-Aug
3171 31-Mar, 01-Apr
3173 31-Oct, 01-Nov
3176 31-Jul, 01-Aug
3186 31-Mar, 01-Apr
3190 31-Aug, 01-Sep
3210 31-Mar, 01-Apr
3212 31-Jul, 01-Aug
3221 31-Jan, 01-Feb
3223 31-Aug, 01-Sep
3226 31-May, 01-Jun
3252 31-Mar, 01-Apr
3260 31-Jul, 01-Aug
3264 29-Feb, 01-Mar
3266 31-Jul, 01-Aug
3267 31-Mar, 01-Apr
3274 31-May, 01-Jun, 31-Aug, 01-Sep
3278 31-Jul, 01-Aug
3285 31-Mar, 01-Apr
3289 31-May, 01-Jun
3297 31-Mar, 01-Apr
3298 31-Dec
3299 01-Jan
3317 31-Jan, 01-Feb
3327 31-Mar, 01-Apr
3328 31-Aug, 01-Sep
3344 31-Jul, 01-Aug
3346 31-Aug, 01-Sep
3351 31-Mar, 01-Apr
3377 31-Jul, 01-Aug
3379 31-Dec
3380 01-Jan
3388 31-May, 01-Jun
3395 31-Oct, 01-Nov
3398 31-Jul, 01-Aug
3407 31-Oct, 01-Nov
3424 29-Feb, 01-Mar
3428 31-Oct, 01-Nov
3430 31-Aug, 01-Sep
3439 31-Aug, 01-Sep
3441 31-Mar, 01-Apr
3470 31-Oct, 01-Nov
3472 31-May, 01-Jun
3475 31-Aug, 01-Sep
3480 31-Mar, 01-Apr
3487 31-Dec
3488 01-Jan
3508 31-Aug, 01-Sep
3511 31-May, 01-Jun
3515 31-Jan, 01-Feb
3521 31-Jul, 01-Aug
3538 31-Dec
3539 01-Jan
3546 31-Mar, 01-Apr
3554 31-Jul, 01-Aug
3564 31-Mar, 01-Apr
3572 31-Jul, 01-Aug
3574 31-Dec
3575 01-Jan, 31-Oct, 01-Nov
3591 31-Mar, 01-Apr
3598 31-May, 01-Jun
3611 31-Jul, 01-Aug
3614 31-Jan, 01-Feb
3632 31-Oct, 01-Nov
3633 31-Mar, 01-Apr
3634 31-Dec
3635 01-Jan
3640 31-Aug, 01-Sep
3648 31-Mar, 01-Apr
3653 31-Jul, 01-Aug
3661 31-Aug, 01-Sep
3670 31-Aug, 01-Sep
3685 31-Dec
3686 01-Jan
3688 29-Feb, 01-Mar, 31-Dec
3689 01-Jan
3692 31-Jul, 01-Aug
3694 31-Dec
3695 01-Jan
3710 31-Jul, 01-Aug
3727 31-Dec
3728 01-Jan
3747 31-Mar, 01-Apr
3748 29-Feb, 01-Mar
3755 31-Jul, 01-Aug
3758 31-Jul, 01-Aug
3787 31-May, 01-Jun
3800 31-Jul, 01-Aug, 31-Oct, 01-Nov
3816 29-Feb, 01-Mar
3818 31-Jul, 01-Aug
3820 29-Feb, 01-Mar
3822 31-Mar, 01-Apr
3827 31-Jan, 01-Feb
3853 31-Aug, 01-Sep
3855 31-Mar, 01-Apr
3857 31-Oct, 01-Nov
3862 31-May, 01-Jun
3868 31-May, 01-Jun
3875 31-Jul, 01-Aug
3877 31-May, 01-Jun
3886 31-Aug, 01-Sep
3887 31-Jul, 01-Aug
3894 31-Mar, 01-Apr
3896 31-Oct, 01-Nov
3899 31-Oct, 01-Nov
3901 31-Aug, 01-Sep
3904 29-Feb, 01-Mar
3914 31-Jan, 01-Feb
3920 31-Jul, 01-Aug
3923 31-Jan, 01-Feb
3928 31-May, 01-Jun
3929 31-Jan, 01-Feb
3932 31-Oct, 01-Nov
3944 31-Jan, 01-Feb
3995 31-Oct, 01-Nov
4000 31-Dec
4001 01-Jan
4007 31-Jul, 01-Aug
4016 31-Oct, 01-Nov
4024 31-Aug, 01-Sep
4064 31-Jul, 01-Aug
4073 31-Jul, 01-Aug
4084 31-May, 01-Jun
4088 31-Oct, 01-Nov
4099 31-Dec
4100 01-Jan
4118 31-Jul, 01-Aug
4123 31-May, 01-Jun
4135 31-Aug, 01-Sep
4141 31-Dec
4142 01-Jan
4150 31-May, 01-Jun
4157 31-Jul, 01-Aug
4162 31-Dec
4163 01-Jan
4171 31-Aug, 01-Sep
4181 31-Jul, 01-Aug, 31-Oct, 01-Nov
4189 31-Dec
4190 01-Jan
4202 31-Jan, 01-Feb
4210 31-Aug, 01-Sep
4220 31-Jan, 01-Feb
4225 31-May, 01-Jun
4231 31-May, 01-Jun, 31-Aug, 01-Sep
4240 31-Dec
4241 01-Jan
4246 31-Dec
4247 01-Jan
4252 31-Dec
4253 01-Jan, 31-Jul, 01-Aug
4262 31-Oct, 01-Nov
4271 31-Jan, 01-Feb
4298 31-Jul, 01-Aug
4306 31-Dec
4307 01-Jan
4310 31-Jul, 01-Aug
4323 31-Mar, 01-Apr
4328 31-Jan, 01-Feb
4334 31-Oct, 01-Nov
4340 31-Oct, 01-Nov
4349 31-Jul, 01-Aug
4352 31-Jan, 01-Feb
4364 31-Jul, 01-Aug
4365 31-Mar, 01-Apr
4383 31-Mar, 01-Apr
4388 31-Jul, 01-Aug
4394 31-Oct, 01-Nov
4396 31-May, 01-Jun
4400 31-Oct, 01-Nov
4409 31-Jan, 01-Feb
4411 31-May, 01-Jun, 31-Dec
4412 01-Jan
4415 31-Jan, 01-Feb
4417 31-May, 01-Jun
4445 31-Oct, 01-Nov
4449 31-Mar, 01-Apr
4456 31-May, 01-Jun
4459 31-Aug, 01-Sep
4464 29-Feb, 01-Mar
4467 31-Mar, 01-Apr
4478 31-Oct, 01-Nov
4480 31-May, 01-Jun
4484 31-Oct, 01-Nov
4486 31-Aug, 01-Sep
4490 31-Jan, 01-Feb
4491 31-Mar, 01-Apr
4525 31-Aug, 01-Sep
4528 31-May, 01-Jun, 31-Aug, 01-Sep
4538 31-Jan, 01-Feb
4559 31-Oct, 01-Nov
4567 31-Aug, 01-Sep
4571 31-Oct, 01-Nov
4580 31-Oct, 01-Nov
4585 31-May, 01-Jun
4597 31-Dec
4598 01-Jan, 31-Oct, 01-Nov
4629 31-Mar, 01-Apr
4630 31-Aug, 01-Sep
4642 31-Dec
4643 01-Jan, 31-Jul, 01-Aug
4650 31-Mar, 01-Apr
4663 31-May, 01-Jun
4669 31-May, 01-Jun
4684 31-Dec
4685 01-Jan, 31-Jul, 01-Aug
4693 31-May, 01-Jun
4695 31-Mar, 01-Apr
4701 31-Mar, 01-Apr
4722 31-Mar, 01-Apr
4726 31-May, 01-Jun
4732 31-Aug, 01-Sep
4752 31-Mar, 01-Apr
4756 31-Dec
4757 01-Jan
4765 31-Aug, 01-Sep
4769 31-Oct, 01-Nov
4779 31-Mar, 01-Apr
4781 31-Jan, 01-Feb
4790 31-Jan, 01-Feb
4793 31-Oct, 01-Nov
4796 31-Oct, 01-Nov
4802 31-Oct, 01-Nov
4803 31-Mar, 01-Apr
4807 31-May, 01-Jun
4813 31-Dec
4814 01-Jan
4816 31-May, 01-Jun
4834 31-May, 01-Jun
4836 31-Mar, 01-Apr
4871 31-Jan, 01-Feb, 31-Jul, 01-Aug
4873 31-May, 01-Jun
4874 31-Oct, 01-Nov
4876 31-May, 01-Jun
4881 31-Mar, 01-Apr
4912 31-Aug, 01-Sep
4914 31-Mar, 01-Apr
4915 31-Aug, 01-Sep
4925 31-Oct, 01-Nov
4927 31-Aug, 01-Sep
4934 31-Oct, 01-Nov
4935 31-Mar, 01-Apr
4936 29-Feb, 01-Mar
4948 31-May, 01-Jun
4950 31-Mar, 01-Apr
4979 31-Jan, 01-Feb
4990 31-Dec
4991 01-Jan
4992 31-Mar, 01-Apr
4996 31-Aug, 01-Sep, 31-Dec
4997 01-Jan
4999 31-May, 01-Jun
5000 31-Jan, 01-Feb
5003 31-Oct, 01-Nov
5004 29-Feb, 01-Mar
5015 31-Jan, 01-Feb
5020 29-Feb, 01-Mar
5029 31-Dec
5030 01-Jan
5039 31-Jul, 01-Aug, 31-Oct, 01-Nov
5041 31-May, 01-Jun
5045 31-Oct, 01-Nov
5053 31-Dec
5054 01-Jan
5067 31-Mar, 01-Apr
5068 31-Aug, 01-Sep
5080 31-Aug, 01-Sep
5082 31-Mar, 01-Apr
5093 31-Jul, 01-Aug
5096 31-Jan, 01-Feb
5104 31-Dec
5105 01-Jan
5108 31-Jan, 01-Feb
5110 31-May, 01-Jun
5116 29-Feb, 01-Mar
5129 31-Jan, 01-Feb
5132 31-Jan, 01-Feb
5144 31-Jul, 01-Aug
5150 31-Oct, 01-Nov
5153 31-Jan, 01-Feb
5158 31-Aug, 01-Sep
5161 31-Aug, 01-Sep
5196 29-Feb, 01-Mar
5229 31-Mar, 01-Apr
5239 31-Aug, 01-Sep
5244 29-Feb, 01-Mar
5255 31-Jul, 01-Aug
5272 31-Aug, 01-Sep
5273 31-Jan, 01-Feb
5276 31-Jul, 01-Aug
5294 31-Jul, 01-Aug
5298 31-Mar, 01-Apr
5302 31-May, 01-Jun
5306 31-Jan, 01-Feb
5326 31-Dec
5327 01-Jan, 31-Jan, 01-Feb
5338 31-May, 01-Jun
5359 31-May, 01-Jun
5371 31-Aug, 01-Sep
5374 31-Dec
5375 01-Jan, 31-Jan, 01-Feb
5378 31-Jan, 01-Feb
5389 31-May, 01-Jun
5396 31-Oct, 01-Nov
5399 31-Jul, 01-Aug
5425 31-May, 01-Jun
5428 31-Dec
5429 01-Jan, 31-Oct, 01-Nov
5437 31-Dec
5438 01-Jan
5441 31-Jan, 01-Feb
5455 31-Aug, 01-Sep
5461 31-May, 01-Jun
5469 31-Mar, 01-Apr
5473 31-Aug, 01-Sep
5480 31-Jan, 01-Feb
5483 31-Jul, 01-Aug
5486 31-Oct, 01-Nov
5512 31-May, 01-Jun
5524 31-Aug, 01-Sep
5531 31-Jan, 01-Feb
5537 31-Oct, 01-Nov
5541 31-Mar, 01-Apr
5542 31-Dec
5543 01-Jan
5557 31-Dec
5558 01-Jan
5560 29-Feb, 01-Mar
5570 31-Jan, 01-Feb
5580 31-Mar, 01-Apr
5582 31-Jan, 01-Feb
5584 31-Aug, 01-Sep
5588 31-Oct, 01-Nov
5603 31-Jul, 01-Aug
5613 31-Mar, 01-Apr
5614 31-Aug, 01-Sep
5616 29-Feb, 01-Mar
5618 31-Oct, 01-Nov
5619 31-Mar, 01-Apr
5635 31-May, 01-Jun
5642 31-Jul, 01-Aug
5643 31-Mar, 01-Apr
5647 31-Dec
5648 01-Jan
5650 31-Aug, 01-Sep
5652 29-Feb, 01-Mar
5655 31-Mar, 01-Apr
5658 31-Mar, 01-Apr
5659 31-Dec
5660 01-Jan
5680 29-Feb, 01-Mar
5681 31-Oct, 01-Nov
5693 31-Jan, 01-Feb
5709 31-Mar, 01-Apr
5716 31-Dec
5717 01-Jan
5721 31-Mar, 01-Apr
5726 31-Oct, 01-Nov
5735 31-Jul, 01-Aug
5738 31-Jan, 01-Feb
5745 31-Mar, 01-Apr
5764 31-Aug, 01-Sep
5768 31-Oct, 01-Nov
5776 31-May, 01-Jun
5785 31-May, 01-Jun
5788 31-Dec
5789 01-Jan
5804 31-Oct, 01-Nov
5818 31-Dec
5819 01-Jan
5823 31-Mar, 01-Apr
5839 31-Aug, 01-Sep
5840 31-Jan, 01-Feb
5848 31-Dec
5849 01-Jan
5850 31-Mar, 01-Apr
5887 31-Aug, 01-Sep
5897 31-Jul, 01-Aug
5909 31-Jan, 01-Feb
5915 31-Jul, 01-Aug
5919 31-Mar, 01-Apr
5930 31-Oct, 01-Nov
5953 31-Dec
5954 01-Jan
5955 31-Mar, 01-Apr
5956 31-May, 01-Jun
5968 31-May, 01-Jun
5976 31-Mar, 01-Apr
5990 31-Jan, 01-Feb
5992 31-Aug, 01-Sep
5996 31-Jul, 01-Aug
5998 31-Aug, 01-Sep
6042 31-Mar, 01-Apr
6050 31-Jan, 01-Feb
6058 31-Aug, 01-Sep
6064 31-Aug, 01-Sep
6073 31-May, 01-Jun
6082 31-May, 01-Jun
6089 31-Oct, 01-Nov
6092 31-Jul, 01-Aug
6099 31-Mar, 01-Apr
6103 31-May, 01-Jun, 31-Dec
6104 01-Jan
6112 31-May, 01-Jun
6113 31-Jul, 01-Aug
6118 31-May, 01-Jun
6124 29-Feb, 01-Mar
6125 31-Jul, 01-Aug
6153 31-Mar, 01-Apr
6158 31-Jul, 01-Aug
6167 31-Jul, 01-Aug, 31-Oct, 01-Nov
6181 31-May, 01-Jun
6184 31-Dec
6185 01-Jan
6196 31-May, 01-Jun, 31-Dec
6197 01-Jan, 31-Jan, 01-Feb
6200 31-Jan, 01-Feb
6201 31-Mar, 01-Apr
6203 31-Jan, 01-Feb
6208 31-Aug, 01-Sep, 31-Dec
6209 01-Jan
6226 31-Aug, 01-Sep
6235 31-Aug, 01-Sep, 31-Dec
6236 01-Jan
6242 31-Oct, 01-Nov
6251 31-Jul, 01-Aug
6255 31-Mar, 01-Apr
6257 31-Jul, 01-Aug
6259 31-Dec
6260 01-Jan
6270 31-Mar, 01-Apr
6273 31-Mar, 01-Apr
6275 31-Jul, 01-Aug
6280 31-Aug, 01-Sep
6281 31-Oct, 01-Nov
6283 31-May, 01-Jun
6298 31-Dec
6299 01-Jan, 31-Jan, 01-Feb
6301 31-May, 01-Jun
6314 31-Jan, 01-Feb
6317 31-Jan, 01-Feb
6320 31-Jan, 01-Feb
6326 31-Oct, 01-Nov
6328 31-May, 01-Jun
6343 31-Aug, 01-Sep
6353 31-Oct, 01-Nov
6394 31-Aug, 01-Sep
6396 29-Feb, 01-Mar
6397 31-May, 01-Jun
6401 31-Jan, 01-Feb
6408 29-Feb, 01-Mar
6422 31-Jan, 01-Feb
6424 31-Aug, 01-Sep
6428 31-Jan, 01-Feb
6435 31-Mar, 01-Apr
6436 29-Feb, 01-Mar
6446 31-Oct, 01-Nov
6452 31-Oct, 01-Nov
6458 31-Jul, 01-Aug
6460 29-Feb, 01-Mar
6475 31-May, 01-Jun
6479 31-Jul, 01-Aug
6488 31-Jan, 01-Feb
6526 31-Aug, 01-Sep
6527 31-Jan, 01-Feb
6530 31-Oct, 01-Nov
6532 31-May, 01-Jun, 31-Dec
6533 01-Jan
6539 31-Jan, 01-Feb
6541 31-May, 01-Jun
6544 31-Dec
6545 01-Jan, 31-Jan, 01-Feb
6547 31-Aug, 01-Sep
6548 31-Jan, 01-Feb
6549 31-Mar, 01-Apr
6554 31-Jan, 01-Feb
6560 31-Jan, 01-Feb
6581 31-Jan, 01-Feb
6599 31-Jul, 01-Aug
6607 31-May, 01-Jun
6613 31-Dec
6614 01-Jan
6620 31-Jan, 01-Feb
6631 31-Aug, 01-Sep
6644 31-Oct, 01-Nov
6650 31-Jan, 01-Feb
6653 31-Jan, 01-Feb
6655 31-Dec
6656 01-Jan, 31-Oct, 01-Nov
6664 31-May, 01-Jun
6666 31-Mar, 01-Apr
6677 31-Jan, 01-Feb
6679 31-May, 01-Jun
6688 31-Dec
6689 01-Jan
6699 31-Mar, 01-Apr
6704 31-Jul, 01-Aug
6710 31-Jul, 01-Aug
6730 31-May, 01-Jun
6731 31-Jul, 01-Aug
6742 31-Aug, 01-Sep
6754 31-May, 01-Jun
6760 29-Feb, 01-Mar
6761 31-Jan, 01-Feb
6763 31-Dec
6764 01-Jan
6768 31-Mar, 01-Apr
6774 31-Mar, 01-Apr
6803 31-Jul, 01-Aug
6806 31-Jul, 01-Aug
6814 31-Dec
6815 01-Jan
6822 31-Mar, 01-Apr
6823 31-Aug, 01-Sep
6831 31-Mar, 01-Apr
6838 31-Aug, 01-Sep
6839 31-Jul, 01-Aug
6851 31-Jan, 01-Feb
6853 31-May, 01-Jun
6859 31-Dec
6860 01-Jan
6863 31-Jan, 01-Feb
6873 31-Mar, 01-Apr
6878 31-Jul, 01-Aug
6884 31-Jan, 01-Feb
6892 31-Dec
6893 01-Jan, 31-Jan, 01-Feb
6895 31-Aug, 01-Sep
6899 31-Oct, 01-Nov
6904 31-Aug, 01-Sep
6914 31-Oct, 01-Nov
6917 31-Oct, 01-Nov
6920 31-Jul, 01-Aug
6929 31-Jul, 01-Aug
6937 31-May, 01-Jun
6940 31-Dec
6941 01-Jan
6953 31-Oct, 01-Nov
6979 31-May, 01-Jun
6983 31-Jul, 01-Aug
7001 31-Oct, 01-Nov
7003 31-Dec
7004 01-Jan
7007 31-Jul, 01-Aug
7008 29-Feb, 01-Mar
7022 31-Jan, 01-Feb
7039 31-May, 01-Jun
7058 31-Oct, 01-Nov
7063 31-May, 01-Jun
7090 31-Dec
7091 01-Jan
7100 31-Jul, 01-Aug
7102 31-Dec
7103 01-Jan
7108 31-May, 01-Jun
7111 31-May, 01-Jun
7118 31-Oct, 01-Nov
7120 31-May, 01-Jun
7124 31-Jul, 01-Aug
7130 31-Oct, 01-Nov
7139 31-Oct, 01-Nov
7151 31-Oct, 01-Nov
7153 31-May, 01-Jun
7169 31-Oct, 01-Nov
7170 31-Mar, 01-Apr
7175 31-Jan, 01-Feb
7183 31-May, 01-Jun
7187 31-Jul, 01-Aug
7209 31-Mar, 01-Apr
7217 31-Jul, 01-Aug
7222 31-May, 01-Jun
7223 31-Jan, 01-Feb, 31-Jul, 01-Aug
7241 31-Jul, 01-Aug
7247 31-Oct, 01-Nov
7248 29-Feb, 01-Mar
7249 31-Dec
7250 01-Jan
7253 31-Oct, 01-Nov
7258 31-Dec
7259 01-Jan
7268 31-Oct, 01-Nov
7274 31-Jan, 01-Feb
7289 31-Jan, 01-Feb
7291 31-Dec
7292 01-Jan
7297 31-Dec
7298 01-Jan
7330 31-Aug, 01-Sep
7343 31-Oct, 01-Nov
7354 31-May, 01-Jun
7363 31-Aug, 01-Sep
7370 31-Oct, 01-Nov
7373 31-Jan, 01-Feb
7384 31-May, 01-Jun
7391 31-Jul, 01-Aug
7405 31-Dec
7406 01-Jan
7421 31-Oct, 01-Nov
7436 31-Oct, 01-Nov
7449 31-Mar, 01-Apr
7450 31-Aug, 01-Sep
7454 31-Oct, 01-Nov
7457 31-Jan, 01-Feb
7466 31-Oct, 01-Nov
7475 31-Oct, 01-Nov
7483 31-Aug, 01-Sep
7496 31-Jul, 01-Aug
7519 31-Aug, 01-Sep
7523 31-Jan, 01-Feb
7529 31-Oct, 01-Nov
7538 31-Jul, 01-Aug
7552 31-Dec
7553 01-Jan
7555 31-Aug, 01-Sep
7560 31-Mar, 01-Apr
7561 31-Aug, 01-Sep
7562 31-Oct, 01-Nov
7570 31-Dec
7571 01-Jan
7585 31-May, 01-Jun
7601 31-Jul, 01-Aug
7608 31-Mar, 01-Apr
7610 31-Jan, 01-Feb, 31-Oct, 01-Nov
7612 31-Aug, 01-Sep
7624 31-May, 01-Jun
7633 31-Dec
7634 01-Jan
7663 31-Aug, 01-Sep, 31-Dec
7664 01-Jan
7672 31-May, 01-Jun
7680 31-Mar, 01-Apr
7684 31-Dec
7685 01-Jan
7692 29-Feb, 01-Mar
7699 31-Dec
7700 01-Jan
7717 31-Aug, 01-Sep
7720 31-Aug, 01-Sep
7730 31-Jul, 01-Aug
7733 31-Jul, 01-Aug
7742 31-Oct, 01-Nov
7744 29-Feb, 01-Mar
7766 31-Jul, 01-Aug
7768 31-Aug, 01-Sep
7770 31-Mar, 01-Apr
7789 31-May, 01-Jun
7790 31-Jan, 01-Feb
7799 31-Jan, 01-Feb
7803 31-Mar, 01-Apr
7806 31-Mar, 01-Apr
7826 31-Jan, 01-Feb
7832 31-Jan, 01-Feb
7837 31-May, 01-Jun
7858 31-Dec
7859 01-Jan, 31-Jul, 01-Aug
7884 31-Mar, 01-Apr
7888 31-May, 01-Jun
7892 31-Jul, 01-Aug
7897 31-Dec
7898 01-Jan
7936 31-Dec
7937 01-Jan
7950 31-Mar, 01-Apr
7957 31-Dec
7958 01-Jan
7966 31-May, 01-Jun
7968 29-Feb, 01-Mar, 31-Mar, 01-Apr
7979 31-Jan, 01-Feb
7982 31-Jan, 01-Feb
7988 31-Oct, 01-Nov
8008 31-May, 01-Jun
8012 31-Oct, 01-Nov
8024 31-Jan, 01-Feb
8029 31-Aug, 01-Sep
8030 31-Oct, 01-Nov
8038 31-Aug, 01-Sep
8039 31-Jul, 01-Aug
8041 31-May, 01-Jun, 31-Dec
8042 01-Jan
8049 31-Mar, 01-Apr
8052 29-Feb, 01-Mar
8055 31-Mar, 01-Apr
8060 31-Jul, 01-Aug
8065 31-Aug, 01-Sep
8086 31-May, 01-Jun
8105 31-Jan, 01-Feb
8110 31-Dec
8111 01-Jan
8127 31-Mar, 01-Apr
8131 31-May, 01-Jun
8149 31-Aug, 01-Sep
8154 31-Mar, 01-Apr
8164 31-Aug, 01-Sep
8191 31-Aug, 01-Sep
8194 31-Dec
8195 01-Jan, 31-Jul, 01-Aug
8198 31-Jan, 01-Feb
8204 31-Jul, 01-Aug
8207 31-Jul, 01-Aug
8210 31-Oct, 01-Nov
8212 31-May, 01-Jun
8220 31-Mar, 01-Apr
8233 31-May, 01-Jun, 31-Dec
8234 01-Jan
8257 31-May, 01-Jun
8262 31-Mar, 01-Apr
8272 31-Aug, 01-Sep
8280 31-Mar, 01-Apr
8283 31-Mar, 01-Apr
8287 31-Aug, 01-Sep
8288 31-Jul, 01-Aug
8294 31-Jul, 01-Aug
8297 31-Jul, 01-Aug
8309 31-Jul, 01-Aug
8317 31-May, 01-Jun
8321 31-Oct, 01-Nov
8324 31-Oct, 01-Nov
8327 31-Jul, 01-Aug, 31-Oct, 01-Nov
8344 31-Aug, 01-Sep
8375 31-Jul, 01-Aug
8384 31-Oct, 01-Nov
8408 31-Jan, 01-Feb
8435 31-Jul, 01-Aug
8440 31-Dec
8441 01-Jan
8446 31-Dec
8447 01-Jan
8455 31-Aug, 01-Sep, 31-Dec
8456 01-Jan
8470 31-May, 01-Jun
8478 31-Mar, 01-Apr
8483 31-Oct, 01-Nov
8490 31-Mar, 01-Apr
8494 31-Aug, 01-Sep
8497 31-May, 01-Jun
8503 31-May, 01-Jun, 31-Dec
8504 01-Jan
8507 31-Jul, 01-Aug
8520 29-Feb, 01-Mar
8528 31-Jan, 01-Feb
8534 31-Jan, 01-Feb
8540 31-Jan, 01-Feb
8545 31-Aug, 01-Sep
8560 31-May, 01-Jun
8573 31-Oct, 01-Nov
8578 31-May, 01-Jun
8581 31-May, 01-Jun
8587 31-Dec
8588 01-Jan
8589 31-Mar, 01-Apr
8594 31-Jan, 01-Feb, 31-Jul, 01-Aug
8599 31-Aug, 01-Sep
8606 31-Jul, 01-Aug
8611 31-Dec
8612 01-Jan
8621 31-Jul, 01-Aug
8642 31-Jul, 01-Aug
8653 31-Dec
8654 01-Jan
8656 31-Dec
8657 01-Jan, 31-Jan, 01-Feb
8659 31-May, 01-Jun
8660 31-Jan, 01-Feb
8665 31-Aug, 01-Sep
8675 31-Jul, 01-Aug
8686 31-Dec
8687 01-Jan
8694 31-Mar, 01-Apr
8743 31-May, 01-Jun
8750 31-Jan, 01-Feb, 31-Oct, 01-Nov
8755 31-Dec
8756 01-Jan
8758 31-May, 01-Jun
8765 31-Jan, 01-Feb
8769 31-Mar, 01-Apr
8783 31-Jul, 01-Aug
8789 31-Oct, 01-Nov
8807 31-Jan, 01-Feb
8813 31-Jan, 01-Feb
8819 31-Jul, 01-Aug, 31-Oct, 01-Nov
8862 31-Mar, 01-Apr
8866 31-May, 01-Jun
8875 31-Dec
8876 01-Jan
8881 31-Aug, 01-Sep
8884 31-Aug, 01-Sep
8892 29-Feb, 01-Mar
8905 31-Aug, 01-Sep
8906 31-Jul, 01-Aug
8909 31-Jul, 01-Aug
8932 31-Aug, 01-Sep
8935 31-May, 01-Jun
8936 31-Jul, 01-Aug
8948 31-Oct, 01-Nov
8967 31-Mar, 01-Apr
8968 29-Feb, 01-Mar
8977 31-May, 01-Jun
8978 31-Oct, 01-Nov
8985 31-Mar, 01-Apr
8989 31-Dec
8990 01-Jan
9000 31-Mar, 01-Apr
9001 31-Dec
9002 01-Jan
9005 31-Jan, 01-Feb
9009 31-Mar, 01-Apr
9014 31-Jan, 01-Feb
9031 31-Dec
9032 01-Jan
9035 31-Jan, 01-Feb
9068 31-Jan, 01-Feb
9082 31-Aug, 01-Sep
9092 31-Oct, 01-Nov
9094 31-Aug, 01-Sep
9122 31-Jan, 01-Feb
9137 31-Oct, 01-Nov
9139 31-May, 01-Jun
9145 31-Aug, 01-Sep
9146 31-Oct, 01-Nov
9155 31-Jan, 01-Feb
9179 31-Jul, 01-Aug
9194 31-Jul, 01-Aug
9204 31-Mar, 01-Apr
9218 31-Jan, 01-Feb
9244 31-Dec
9245 01-Jan
9249 31-Mar, 01-Apr
9263 31-Jul, 01-Aug
9275 31-Jan, 01-Feb
9290 31-Oct, 01-Nov
9301 31-Aug, 01-Sep
9304 31-Dec
9305 01-Jan
9310 31-Aug, 01-Sep
9313 31-Aug, 01-Sep, 31-Dec
9314 01-Jan
9323 31-Oct, 01-Nov
9326 31-Jul, 01-Aug
9328 31-May, 01-Jun
9330 31-Mar, 01-Apr
9344 31-Jan, 01-Feb
9370 31-May, 01-Jun
9373 31-May, 01-Jun
9392 31-Oct, 01-Nov
9395 31-Oct, 01-Nov
9397 31-Aug, 01-Sep
9415 31-May, 01-Jun
9431 31-Jan, 01-Feb, 31-Oct, 01-Nov
9435 31-Mar, 01-Apr
9447 31-Mar, 01-Apr
9451 31-Aug, 01-Sep
9464 31-Oct, 01-Nov
9467 31-Jul, 01-Aug
9482 31-Jul, 01-Aug
9490 31-Aug, 01-Sep
9519 31-Mar, 01-Apr
9532 29-Feb, 01-Mar
9536 31-Jul, 01-Aug
9547 31-Aug, 01-Sep, 31-Dec
9548 01-Jan, 31-Oct, 01-Nov
9559 31-May, 01-Jun
9566 31-Oct, 01-Nov
9575 31-Jan, 01-Feb
9577 31-May, 01-Jun
9625 31-Aug, 01-Sep
9637 31-May, 01-Jun
9658 31-Aug, 01-Sep
9662 31-Jan, 01-Feb
9673 31-Dec
9674 01-Jan
9693 31-Mar, 01-Apr
9694 31-May, 01-Jun
9696 29-Feb, 01-Mar
9700 31-Aug, 01-Sep
9701 31-Jan, 01-Feb
9731 31-Jan, 01-Feb
9750 31-Mar, 01-Apr
9760 31-Aug, 01-Sep
9765 31-Mar, 01-Apr
9766 31-Dec
9767 01-Jan
9770 31-Jan, 01-Feb
9773 31-Jan, 01-Feb
9780 31-Mar, 01-Apr
9812 31-Jan, 01-Feb
9817 31-Dec
9818 01-Jan
9830 31-Jan, 01-Feb
9832 31-May, 01-Jun
9833 31-Jul, 01-Aug
9838 31-Aug, 01-Sep
9841 31-Aug, 01-Sep
9843 31-Mar, 01-Apr
9850 31-Dec
9851 01-Jan, 31-Jan, 01-Feb
9864 31-Mar, 01-Apr
9868 31-May, 01-Jun
9872 31-Jul, 01-Aug
9876 31-Mar, 01-Apr
9884 31-Oct, 01-Nov
9889 31-May, 01-Jun
9913 31-May, 01-Jun
9925 31-Aug, 01-Sep
9956 31-Jul, 01-Aug
9959 31-Jul, 01-Aug
9968 31-Jan, 01-Feb
9976 31-Dec
9977 01-Jan
9997 31-May, 01-Jun
**edit** revised version, one step shorter, less clunky display routine. I will leave the original version on which Paul commented above.
Code:
001 LBL 'PPD' Label "Prime Pair Dates"
002 STO 03 Store input year in register 3
003 SDL 004 multiply by 10000
004 INC X add 1 to YYYY0000, now have YYYY0001
005 SDR 002 divide by 100 to get in form to allow month to be incremented
006 STO 01 store YYYY00.01 in reg 1
007 #11 enter constant 11
008 STO 04 store 11 in loop counter
009 XEQ 01 check YYYx.1231/YYYY0101, YYYY0131/0201…YYYY1031/1101*
010 DSE 04 decrement counter
011 BACK 002 go back to check next date pair
012 #89 when done checking through 1031/1101, enter constant 89
013 STO+ 01 add 89 to YYYY11.01 to get YYYz00.01
014 XEQ 01 check YYYY.1231/YYYz0101
015 RCL 03 recall input year to display when complete
016 STOP
017 LBL 01 subroutine to check date pairs for prime
018 INC 01 increment month
019 RCL 01 recall first of month date
020 SDL 02 multiply by 100 to get in proper form
021 PRIME? is first of month date prime?
022 SKIP 001 if prime, skip to check last of previous month
023 RTN if not prime, return to get next month
024 SDR 004 divide by 10,000 to get in form to allow date arithmetic
025 1 enter 1
026 +/- enter -1
027 DAYS+ subtract 1 day from 1st of month to get last of previous month
028 SDL 004 multiply by 10000 to get in proper form
029 PRIME? is last of prior month date prime?
030 SKIP 001 if prime, skip to display prime date(s)
031 RTN if not prime, return to get next month
032 XEQ 02 execute display subroutine
033 RCL 01 recall first of month date
034 SDL 002 multiply by 100 to get in proper form for display
035 LBL 02 subroutine to display prime date(s)
036 RCL X duplicate X value
037 SDR 004 divide year by 10000
038 IP take integer portion to get year value YYY?
039 x=/=? 03 compare YYY? to input year
040 SKIP 002 if not equal, do not display prime date, it is in wrong year
041 VIEW Y display date
042 PSE 25 pause to display prime date
043 RTN
**edit 2** I ultimately got around to analyzing Paul's and Eric's versions to see what tips and tricks they used that I likely missed. I discovered similarities, of course. Eric’s posted version, at 50 steps, is a bit longer than the best version I came up with before checking others, but as he noted, it can be easily shortened. A few simple changes (e.g. changing the direct entry of 8800 to CONST #088 SDL 002 and changing the multiplications and divisions by 10000 to SDL 004 and SDR 004) and removing the labels and replacing the GTOs with SKIPs and BACKs reduces it to only 38 steps.
After seeing Eric's program, I first applied his technique of adding 100 to the date instead of dividing by 100 and adding 1 to increment the month. That got my program down to 42 steps. I then applied his technique of using flags to handle dates outside of the test year, and came up with what I believe to be the best I can do, 39 steps, with initialization of date mode and finishing with display of the input year. I prefer this to having the program finish with display of first of the following year, because that looks like an output and could confuse the judges :-) Anyhow, here is that version.
Code:
001 LBL 'PPD' Label "Prime Pair Dates"
002 Y.MD Set y.md mode to allow date arithmetic
003 CF ALL clear all flags to initialize Flag 1 and Flag 2
004 STO 01 Store input year in register 1
005 SDL 004 multiply by 10000
006 INC X add 1 to YYYY0000, now have YYYY0001
007 STO 02 store YYYY0001 in reg 2
008 #11 enter constant 11
009 STO 03 store 11 in loop counter
010 XEQ 01 check YYYx.1231/YYYY0101, YYYY0131/0201…YYYY1031/1101
011 DSE 03 decrement counter
012 BACK 002 go back to check next date pair
013 SF 02 Set flag 2 to not display YYYz0101
014 #89 when done checking through 1031/1101,
015 SDL 002 ...enter constant 8900
016 STO+ 02 add 8900 to YYYY1101 to get YYYz0001
017 LBL 01 subroutine to check date pairs for prime
018 # 100 enter constant 100
019 STO+ 02 increment month
020 RCL 02 recall first of month date
021 PRIME? is first of month date prime?
022 SKIP 003 if prime, skip to check last of previous month
023 SF 01 set flag 1 to display last of prior month if prime after YYYx1231
024 RCL 01 recall input year to display when complete
025 RTN return for next month or stop.
026 SDR 004 divide prime date by 10,000 to allow date arithmetic
027 1 enter 1
028 +/- enter -1
029 DAYS+ subtract 1 day from 1st of month to get last of previous month
030 SDL 004 multiply by 10000 to get in proper form
031 PRIME? is last of prior month date prime?
032 SKIP 001 if prime, we have a prime pair, skip to display prime date(s)
033 BACK 010 if not prime, loop back for next month or to exit
034 FS? 01 Flag 1 clear first to skip display of YYYx1231, set after that
035 PSE 10 pause to display prime date
036 RCL 02 recall first of month date
037 FC? 02 Flag 2 set last iteration to skip display of YYYz0101
038 PSE 10 pause to display prime date
039 BACK 016 loop back to return
**edit 3** A couple more improvements gets it down to 38 steps if the final END is included, while still displaying the input year when the program is done. This could drop to 37 steps if I was satisfied with displaying a zero when done, or 36 steps if the judges were told to ignore the value in the display when the program stops running. This value will either be YYYY1231 or YYYz0101, either of which gives the appearance of an output, so I would prefer to suppress.
Code:
001 LBL 'PPD' Label "Prime Pair Dates"
002 Y.MD Set y.md mode to allow date arithmetic
003 CF ALL clear all flags to initialize Flag 1 and Flag 2
004 STO 00 Store input year in register 0 to display when done. This step
could be eliminated, see comments regarding display at completion
005 SDL 004 multiply by 10000
006 INC X add 1 to YYYY0000, now have YYYY0001
007 #11 enter constant 11
008 C-STO J store 11 for loop counter in J and YYYY0001 in K using complex store
009 XEQ 01 check YYYx.1231/YYYY0101, YYYY0131/0201…YYYY1031/1101
010 DSE J decrement counter
011 BACK 002 go back to check next date pair
012 SF 02 Set flag 2 to not display YYYz0101
013 #89 when done checking through 1031/1101,
014 SDL 002 ...enter constant 8900
015 STO+ K add 8900 to YYYY1101 to get YYYz0001
016 LBL 01 subroutine to check date pairs for prime
017 # 100 enter constant 100
018 STO+ K increment month
019 RCL K recall first of month date
020 PRIME? is first of month date prime?
021 SKIP 001 if prime, skip to check last of previous month
022 SKIP 013 if not prime, skip to common loop-back/end point
023 SDR 004 divide prime date by 10,000 to allow date arithmetic
024 1 enter 1
025 +/- enter -1
026 DAYS+ subtract 1 day from 1st of month to get last of previous month
027 SDL 004 multiply by 10000 to get in proper form
028 PRIME? is last of prior month date prime?
029 SKIP 001 if prime, we have a prime pair, skip to display prime date(s)
030 SKIP 005 if not prime, skip to common loop-back/end point
031 FS? 01 Flag 1 clear first to skip display of YYYx1231, set after that
032 PSE 10 pause to display prime date
033 RCL K recall first of month date
034 FC? 02 Flag 2 set last iteration to skip display of YYYz0101
035 PSE 10 pause to display prime date
036 SF 01 set flag 1 to display last of prior month if prime after YYYx1231
037 RCL 00 recall input year to display when complete. This step could be
a CLx or eliminated, see comments regarding display at completion
038 END loop back or stop when done
RE: HHC 2014 Programming Contest - Paul Dale - 10-06-2014 09:34 PM
(10-06-2014 05:01 PM)Jeff O. Wrote: I was able to develop a 44 step program that seems as fast as my 83 step version. There may be opportunities to shave a few steps off of that, but I think I'm pretty satisfied at this point.
Interesting program and great use of the 34S features.
One immediate step can be saved -- you don't need the final RTN. A second by omitting the initial label, although that might make reruns harder.
- Pauli
RE: HHC 2014 Programming Contest - Jeff O. - 10-07-2014 12:26 PM
(10-06-2014 09:34 PM)Paul Dale Wrote: Interesting program and great use of the 34S features.
I kept discovering features that helped. Very early versions had a Leap year determination routine. At one point I wondered if wp34s had a leap year function, that saved a ton of steps. Then discovered the Date arithmetic, which eliminates the need for leap year determination altogether as wp34s knows that the day before 01 March is 29 February in leap years. (I knew it had Prime? all along, I never tried to build a prime checking routine.)
(10-06-2014 09:34 PM)Paul Dale Wrote: One immediate step can be saved -- you don't need the final RTN. A second by omitting the initial label, although that might make reruns harder.
Never thought to check if END works like RTN, just figured it is the separator for alpha labelled programs. Of course, the manual clearly states “Works like RTN in all other aspects.” So I will accept that reduction, although then it seems like we should count the final END statement, so maybe no reduction. I think the label is needed to make it easy on the judges to run multiple test cases.
Thanks again for your comments.
Jeff
|