Post Reply 
HHC 2014 Programming Contest
09-28-2014, 11:58 AM
Post: #22
RE: HHC 2014 Programming Contest
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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HHC 2014 Programming Contest - Paul Dale - 09-24-2014, 09:13 AM
RE: HHC 2014 Programming Contest - BruceH - 10-02-2014, 09:35 PM
RE: HHC 2014 Programming Contest - Neil Hamilton - 09-28-2014 11:58 AM
RE: HHC 2014 Programming Contest - Jeff O. - 09-29-2014, 01:41 PM
RE: HHC 2014 Programming Contest - Jeff O. - 09-30-2014, 04:39 PM
RE: HHC 2014 Programming Contest - Jeff O. - 10-06-2014, 05:01 PM
RE: HHC 2014 Programming Contest - Jeff O. - 10-07-2014, 12:26 PM
RE: HHC 2014 Programming Contest - Werner - 10-03-2014, 07:35 AM
RE: HHC 2014 Programming Contest - C.Ret - 10-05-2014, 10:02 AM
RE: HHC 2014 Programming Contest - Werner - 10-05-2014, 08:02 PM



User(s) browsing this thread: 1 Guest(s)