Back to index.

The problem: https://projecteuler.net/problem=44

If we put $f(x) = \frac 1 2 x(3x-1)$, then $f'(x) = \frac 1 2 (6x - 1)$, which is positive for all $x \geq 1$. Thus, $P_n$ is an increasing sequence.

Another thing is that $P_n$ is an integer for each positive integer $n$. If $n$ is even, then $n(3n-1)$ is also even because it's $n$ times something. If $n$ is odd, then so is $3n$, which gives $3n-1$ even. That gives $n(3n-1)$ even for all positive integers $n$.

Using the quadratic formula, we find that if a positive number $A$ is a pentagonal number $P_n$, then it must be true that $6n - 1 = \sqrt{1 + 24A}$. That is $\sqrt{1 + 24A}$ is an integer and it is congruent to 5 modulo 6.

We now try to find a solution $i, j, m, n$ such that $P_i = P_n + P_m$ and $P_j = P_n - P_m$.

In [47]:
def P(n):
    return n*(3*n - 1)//2

def integer_sqrt(n):
    if n < 0:
        return -1
    if n == 1 or n == 0:
        return n
    lo = 1
    hi = n
    while lo <= hi:
        mid = (hi+lo)//2
        square = mid*mid
        if square == n:
            return mid
        elif square > n:
            hi = mid-1
        else:
            lo = mid+1
    return -1

def find_pentagonal_index(A):
    d = 1 + 24*A
    six_n_minus_1 = integer_sqrt(d)
    if six_n_minus_1 < 0:
        return 0
    if six_n_minus_1 % 6 != 5:
        return 0
    return (six_n_minus_1 + 1)//6

def search_for_first_solution():
    m = 1
    while True:
        P_m = P(m)
        for n in range(1, m):
            P_n = P(n)
            s = P_n + P_m
            d = P_m - P_n
            i = find_pentagonal_index(s)
            j = find_pentagonal_index(d)
            if i > 0 and j > 0:
                return (m, n, i, j)
        m += 1

(m0, n0, i0, j0) = search_for_first_solution()
print(m0, n0)
print(P(m0), P(n0))
print(i0, j0)
print(P(i0), P(j0))
2167 1020
7042750 1560090
2395 1912
8602840 5482660

Ok. So that took a while. The idea now is that we know that our minimized difference must be at most $M = 5482660$.

We have $P_{n+1} - P_n = 3n + 1$. Not just that, for two positive integers $n, k$, we have $P_{n+k} - P_n = \frac 1 2 \left (6k n + 3k^2 - k \right )$. That is, if we fix $k$, $P_{n+k} - P_n$ is an increasing afine function of $n$. This means we can easily bound our loop variables since we know $P_{n+k} - P_n \leq M.$ In summary, we need $n \leq \frac {2M + k - 3k^2} {6k}$ and $2M + k - 3k^2 > 0$.

The inequality $2M + k - 3k^2 > 0$, by using the quadratic formula, implies $k < \frac {1 + \sqrt{1 + 24M}} {6}$ and we know, since $M = P(1912)$, by the considerations above, that $\frac {1 + \sqrt{1 + 24M}} {6}$ is an integer.

In our search for better and better differences, once we find a better one, we can update how we calculate the upper bounds for k and n.

In [63]:
k = 1
M = P(j0)
k_upper = (1 + integer_sqrt(1 + 24*M))//6

least_m = m0
least_n = n0
least_i = i0
least_j = i0
least_D = M

import timeit

start_time = timeit.default_timer()

while k < k_upper:
    n_upper = (2*least_D + k - 3*k*k) // (6*k) + 1
    print(k, k_upper, n_upper, end = ';\t')
    for n in range(1, n_upper):
        P_n = P(n)
        m = n + k
        P_m = P(m)
        s = P_n + P_m
        d = P_m - P_n
        if d < least_D:
            i = find_pentagonal_index(s)
            j = find_pentagonal_index(d)
            if i > 0 and j > 0:
                least_m = m
                least_n = n
                least_i = i
                least_j = j
                least_D = d
                k_upper = (1 + integer_sqrt(1 + 24*least_D))//6
    k += 1

elapsed = timeit.default_timer() - start_time

print("Answer (m, n, i, j, D)", least_m, least_n, least_i, least_j, least_D)
print("It took", elapsed, "seconds.")
1 1912 1827554;	2 1912 913776;	3 1912 609184;	4 1912 456887;	5 1912 365509;	6 1912 304590;	7 1912 261076;	8 1912 228441;	9 1912 203058;	10 1912 182751;	11 1912 166136;	12 1912 152291;	13 1912 140575;	14 1912 130533;	15 1912 121830;	16 1912 114215;	17 1912 107495;	18 1912 101522;	19 1912 96178;	20 1912 91368;	21 1912 87017;	22 1912 83060;	23 1912 79448;	24 1912 76137;	25 1912 73090;	26 1912 70278;	27 1912 67674;	28 1912 65256;	29 1912 63005;	30 1912 60904;	31 1912 58939;	32 1912 57096;	33 1912 55365;	34 1912 53735;	35 1912 52199;	36 1912 50748;	37 1912 49376;	38 1912 48075;	39 1912 46842;	40 1912 45670;	41 1912 44555;	42 1912 43493;	43 1912 42480;	44 1912 41514;	45 1912 40590;	46 1912 39707;	47 1912 38861;	48 1912 38051;	49 1912 37273;	50 1912 36527;	51 1912 35810;	52 1912 35120;	53 1912 34456;	54 1912 33817;	55 1912 33201;	56 1912 32608;	57 1912 32035;	58 1912 31481;	59 1912 30947;	60 1912 30430;	61 1912 29930;	62 1912 29446;	63 1912 28978;	64 1912 28524;	65 1912 28084;	66 1912 27658;	67 1912 27244;	68 1912 26842;	69 1912 26452;	70 1912 26074;	71 1912 25705;	72 1912 25347;	73 1912 24999;	74 1912 24660;	75 1912 24331;	76 1912 24009;	77 1912 23697;	78 1912 23392;	79 1912 23095;	80 1912 22805;	81 1912 22523;	82 1912 22247;	83 1912 21978;	84 1912 21715;	85 1912 21459;	86 1912 21208;	87 1912 20964;	88 1912 20724;	89 1912 20490;	90 1912 20262;	91 1912 20038;	92 1912 19819;	93 1912 19605;	94 1912 19396;	95 1912 19191;	96 1912 18990;	97 1912 18793;	98 1912 18600;	99 1912 18411;	100 1912 18226;	101 1912 18045;	102 1912 17867;	103 1912 17692;	104 1912 17521;	105 1912 17353;	106 1912 17189;	107 1912 17027;	108 1912 16868;	109 1912 16713;	110 1912 16560;	111 1912 16410;	112 1912 16262;	113 1912 16117;	114 1912 15975;	115 1912 15835;	116 1912 15697;	117 1912 15562;	118 1912 15429;	119 1912 15299;	120 1912 15170;	121 1912 15044;	122 1912 14920;	123 1912 14797;	124 1912 14677;	125 1912 14559;	126 1912 14442;	127 1912 14327;	128 1912 14214;	129 1912 14103;	130 1912 13994;	131 1912 13886;	132 1912 13780;	133 1912 13675;	134 1912 13572;	135 1912 13471;	136 1912 13371;	137 1912 13272;	138 1912 13175;	139 1912 13079;	140 1912 12985;	141 1912 12892;	142 1912 12800;	143 1912 12709;	144 1912 12620;	145 1912 12532;	146 1912 12445;	147 1912 12360;	148 1912 12275;	149 1912 12192;	150 1912 12109;	151 1912 12028;	152 1912 11948;	153 1912 11869;	154 1912 11791;	155 1912 11714;	156 1912 11638;	157 1912 11563;	158 1912 11488;	159 1912 11415;	160 1912 11343;	161 1912 11271;	162 1912 11201;	163 1912 11131;	164 1912 11062;	165 1912 10994;	166 1912 10927;	167 1912 10861;	168 1912 10795;	169 1912 10730;	170 1912 10666;	171 1912 10603;	172 1912 10540;	173 1912 10478;	174 1912 10417;	175 1912 10356;	176 1912 10296;	177 1912 10237;	178 1912 10179;	179 1912 10121;	180 1912 10064;	181 1912 10007;	182 1912 9951;	183 1912 9896;	184 1912 9841;	185 1912 9787;	186 1912 9733;	187 1912 9680;	188 1912 9628;	189 1912 9576;	190 1912 9524;	191 1912 9474;	192 1912 9423;	193 1912 9373;	194 1912 9324;	195 1912 9275;	196 1912 9227;	197 1912 9179;	198 1912 9132;	199 1912 9085;	200 1912 9038;	201 1912 8992;	202 1912 8947;	203 1912 8902;	204 1912 8857;	205 1912 8813;	206 1912 8769;	207 1912 8726;	208 1912 8683;	209 1912 8640;	210 1912 8598;	211 1912 8557;	212 1912 8515;	213 1912 8474;	214 1912 8434;	215 1912 8393;	216 1912 8354;	217 1912 8314;	218 1912 8275;	219 1912 8236;	220 1912 8198;	221 1912 8160;	222 1912 8122;	223 1912 8084;	224 1912 8047;	225 1912 8011;	226 1912 7974;	227 1912 7938;	228 1912 7902;	229 1912 7867;	230 1912 7832;	231 1912 7797;	232 1912 7762;	233 1912 7728;	234 1912 7694;	235 1912 7660;	236 1912 7627;	237 1912 7593;	238 1912 7560;	239 1912 7528;	240 1912 7495;	241 1912 7463;	242 1912 7432;	243 1912 7400;	244 1912 7369;	245 1912 7338;	246 1912 7307;	247 1912 7276;	248 1912 7246;	249 1912 7216;	250 1912 7186;	251 1912 7156;	252 1912 7127;	253 1912 7098;	254 1912 7069;	255 1912 7040;	256 1912 7012;	257 1912 6983;	258 1912 6955;	259 1912 6927;	260 1912 6900;	261 1912 6872;	262 1912 6845;	263 1912 6818;	264 1912 6791;	265 1912 6765;	266 1912 6738;	267 1912 6712;	268 1912 6686;	269 1912 6660;	270 1912 6634;	271 1912 6609;	272 1912 6584;	273 1912 6559;	274 1912 6534;	275 1912 6509;	276 1912 6484;	277 1912 6460;	278 1912 6436;	279 1912 6412;	280 1912 6388;	281 1912 6364;	282 1912 6340;	283 1912 6317;	284 1912 6294;	285 1912 6271;	286 1912 6248;	287 1912 6225;	288 1912 6202;	289 1912 6180;	290 1912 6158;	291 1912 6135;	292 1912 6113;	293 1912 6092;	294 1912 6070;	295 1912 6048;	296 1912 6027;	297 1912 6006;	298 1912 5984;	299 1912 5963;	300 1912 5943;	301 1912 5922;	302 1912 5901;	303 1912 5881;	304 1912 5860;	305 1912 5840;	306 1912 5820;	307 1912 5800;	308 1912 5780;	309 1912 5761;	310 1912 5741;	311 1912 5722;	312 1912 5702;	313 1912 5683;	314 1912 5664;	315 1912 5645;	316 1912 5626;	317 1912 5607;	318 1912 5589;	319 1912 5570;	320 1912 5552;	321 1912 5533;	322 1912 5515;	323 1912 5497;	324 1912 5479;	325 1912 5461;	326 1912 5444;	327 1912 5426;	328 1912 5408;	329 1912 5391;	330 1912 5374;	331 1912 5356;	332 1912 5339;	333 1912 5322;	334 1912 5305;	335 1912 5289;	336 1912 5272;	337 1912 5255;	338 1912 5239;	339 1912 5222;	340 1912 5206;	341 1912 5190;	342 1912 5173;	343 1912 5157;	344 1912 5141;	345 1912 5125;	346 1912 5110;	347 1912 5094;	348 1912 5078;	349 1912 5063;	350 1912 5047;	351 1912 5032;	352 1912 5017;	353 1912 5001;	354 1912 4986;	355 1912 4971;	356 1912 4956;	357 1912 4941;	358 1912 4927;	359 1912 4912;	360 1912 4897;	361 1912 4883;	362 1912 4868;	363 1912 4854;	364 1912 4839;	365 1912 4825;	366 1912 4811;	367 1912 4797;	368 1912 4783;	369 1912 4769;	370 1912 4755;	371 1912 4741;	372 1912 4727;	373 1912 4714;	374 1912 4700;	375 1912 4687;	376 1912 4673;	377 1912 4660;	378 1912 4646;	379 1912 4633;	380 1912 4620;	381 1912 4607;	382 1912 4594;	383 1912 4581;	384 1912 4568;	385 1912 4555;	386 1912 4542;	387 1912 4530;	388 1912 4517;	389 1912 4504;	390 1912 4492;	391 1912 4479;	392 1912 4467;	393 1912 4454;	394 1912 4442;	395 1912 4430;	396 1912 4418;	397 1912 4406;	398 1912 4394;	399 1912 4382;	400 1912 4370;	401 1912 4358;	402 1912 4346;	403 1912 4334;	404 1912 4322;	405 1912 4311;	406 1912 4299;	407 1912 4287;	408 1912 4276;	409 1912 4265;	410 1912 4253;	411 1912 4242;	412 1912 4230;	413 1912 4219;	414 1912 4208;	415 1912 4197;	416 1912 4186;	417 1912 4175;	418 1912 4164;	419 1912 4153;	420 1912 4142;	421 1912 4131;	422 1912 4120;	423 1912 4110;	424 1912 4099;	425 1912 4088;	426 1912 4078;	427 1912 4067;	428 1912 4057;	429 1912 4046;	430 1912 4036;	431 1912 4025;	432 1912 4015;	433 1912 4005;	434 1912 3995;	435 1912 3984;	436 1912 3974;	437 1912 3964;	438 1912 3954;	439 1912 3944;	440 1912 3934;	441 1912 3924;	442 1912 3914;	443 1912 3905;	444 1912 3895;	445 1912 3885;	446 1912 3875;	447 1912 3866;	448 1912 3856;	449 1912 3846;	450 1912 3837;	451 1912 3827;	452 1912 3818;	453 1912 3809;	454 1912 3799;	455 1912 3790;	456 1912 3780;	457 1912 3771;	458 1912 3762;	459 1912 3753;	460 1912 3744;	461 1912 3734;	462 1912 3725;	463 1912 3716;	464 1912 3707;	465 1912 3698;	466 1912 3689;	467 1912 3681;	468 1912 3672;	469 1912 3663;	470 1912 3654;	471 1912 3645;	472 1912 3637;	473 1912 3628;	474 1912 3619;	475 1912 3611;	476 1912 3602;	477 1912 3594;	478 1912 3585;	479 1912 3577;	480 1912 3568;	481 1912 3560;	482 1912 3551;	483 1912 3543;	484 1912 3535;	485 1912 3526;	486 1912 3518;	487 1912 3510;	488 1912 3502;	489 1912 3493;	490 1912 3485;	491 1912 3477;	492 1912 3469;	493 1912 3461;	494 1912 3453;	495 1912 3445;	496 1912 3437;	497 1912 3429;	498 1912 3421;	499 1912 3414;	500 1912 3406;	501 1912 3398;	502 1912 3390;	503 1912 3382;	504 1912 3375;	505 1912 3367;	506 1912 3359;	507 1912 3352;	508 1912 3344;	509 1912 3337;	510 1912 3329;	511 1912 3322;	512 1912 3314;	513 1912 3307;	514 1912 3299;	515 1912 3292;	516 1912 3284;	517 1912 3277;	518 1912 3270;	519 1912 3262;	520 1912 3255;	521 1912 3248;	522 1912 3241;	523 1912 3234;	524 1912 3226;	525 1912 3219;	526 1912 3212;	527 1912 3205;	528 1912 3198;	529 1912 3191;	530 1912 3184;	531 1912 3177;	532 1912 3170;	533 1912 3163;	534 1912 3156;	535 1912 3149;	536 1912 3142;	537 1912 3135;	538 1912 3129;	539 1912 3122;	540 1912 3115;	541 1912 3108;	542 1912 3102;	543 1912 3095;	544 1912 3088;	545 1912 3081;	546 1912 3075;	547 1912 3068;	548 1912 3062;	549 1912 3055;	550 1912 3048;	551 1912 3042;	552 1912 3035;	553 1912 3029;	554 1912 3022;	555 1912 3016;	556 1912 3010;	557 1912 3003;	558 1912 2997;	559 1912 2990;	560 1912 2984;	561 1912 2978;	562 1912 2972;	563 1912 2965;	564 1912 2959;	565 1912 2953;	566 1912 2947;	567 1912 2940;	568 1912 2934;	569 1912 2928;	570 1912 2922;	571 1912 2916;	572 1912 2910;	573 1912 2904;	574 1912 2898;	575 1912 2892;	576 1912 2886;	577 1912 2880;	578 1912 2874;	579 1912 2868;	580 1912 2862;	581 1912 2856;	582 1912 2850;	583 1912 2844;	584 1912 2838;	585 1912 2832;	586 1912 2826;	587 1912 2821;	588 1912 2815;	589 1912 2809;	590 1912 2803;	591 1912 2797;	592 1912 2792;	593 1912 2786;	594 1912 2780;	595 1912 2775;	596 1912 2769;	597 1912 2763;	598 1912 2758;	599 1912 2752;	600 1912 2747;	601 1912 2741;	602 1912 2735;	603 1912 2730;	604 1912 2724;	605 1912 2719;	606 1912 2713;	607 1912 2708;	608 1912 2703;	609 1912 2697;	610 1912 2692;	611 1912 2686;	612 1912 2681;	613 1912 2675;	614 1912 2670;	615 1912 2665;	616 1912 2659;	617 1912 2654;	618 1912 2649;	619 1912 2644;	620 1912 2638;	621 1912 2633;	622 1912 2628;	623 1912 2623;	624 1912 2617;	625 1912 2612;	626 1912 2607;	627 1912 2602;	628 1912 2597;	629 1912 2592;	630 1912 2587;	631 1912 2581;	632 1912 2576;	633 1912 2571;	634 1912 2566;	635 1912 2561;	636 1912 2556;	637 1912 2551;	638 1912 2546;	639 1912 2541;	640 1912 2536;	641 1912 2531;	642 1912 2526;	643 1912 2521;	644 1912 2516;	645 1912 2512;	646 1912 2507;	647 1912 2502;	648 1912 2497;	649 1912 2492;	650 1912 2487;	651 1912 2482;	652 1912 2478;	653 1912 2473;	654 1912 2468;	655 1912 2463;	656 1912 2459;	657 1912 2454;	658 1912 2449;	659 1912 2444;	660 1912 2440;	661 1912 2435;	662 1912 2430;	663 1912 2426;	664 1912 2421;	665 1912 2416;	666 1912 2412;	667 1912 2407;	668 1912 2403;	669 1912 2398;	670 1912 2393;	671 1912 2389;	672 1912 2384;	673 1912 2380;	674 1912 2375;	675 1912 2371;	676 1912 2366;	677 1912 2362;	678 1912 2357;	679 1912 2353;	680 1912 2348;	681 1912 2344;	682 1912 2339;	683 1912 2335;	684 1912 2331;	685 1912 2326;	686 1912 2322;	687 1912 2317;	688 1912 2313;	689 1912 2309;	690 1912 2304;	691 1912 2300;	692 1912 2296;	693 1912 2291;	694 1912 2287;	695 1912 2283;	696 1912 2278;	697 1912 2274;	698 1912 2270;	699 1912 2266;	700 1912 2261;	701 1912 2257;	702 1912 2253;	703 1912 2249;	704 1912 2245;	705 1912 2240;	706 1912 2236;	707 1912 2232;	708 1912 2228;	709 1912 2224;	710 1912 2220;	711 1912 2216;	712 1912 2211;	713 1912 2207;	714 1912 2203;	715 1912 2199;	716 1912 2195;	717 1912 2191;	718 1912 2187;	719 1912 2183;	720 1912 2179;	721 1912 2175;	722 1912 2171;	723 1912 2167;	724 1912 2163;	725 1912 2159;	726 1912 2155;	727 1912 2151;	728 1912 2147;	729 1912 2143;	730 1912 2139;	731 1912 2135;	732 1912 2131;	733 1912 2127;	734 1912 2124;	735 1912 2120;	736 1912 2116;	737 1912 2112;	738 1912 2108;	739 1912 2104;	740 1912 2100;	741 1912 2097;	742 1912 2093;	743 1912 2089;	744 1912 2085;	745 1912 2081;	746 1912 2077;	747 1912 2074;	748 1912 2070;	749 1912 2066;	750 1912 2062;	751 1912 2059;	752 1912 2055;	753 1912 2051;	754 1912 2047;	755 1912 2044;	756 1912 2040;	757 1912 2036;	758 1912 2033;	759 1912 2029;	760 1912 2025;	761 1912 2022;	762 1912 2018;	763 1912 2014;	764 1912 2011;	765 1912 2007;	766 1912 2004;	767 1912 2000;	768 1912 1996;	769 1912 1993;	770 1912 1989;	771 1912 1986;	772 1912 1982;	773 1912 1978;	774 1912 1975;	775 1912 1971;	776 1912 1968;	777 1912 1964;	778 1912 1961;	779 1912 1957;	780 1912 1954;	781 1912 1950;	782 1912 1947;	783 1912 1943;	784 1912 1940;	785 1912 1936;	786 1912 1933;	787 1912 1929;	788 1912 1926;	789 1912 1922;	790 1912 1919;	791 1912 1916;	792 1912 1912;	793 1912 1909;	794 1912 1905;	795 1912 1902;	796 1912 1899;	797 1912 1895;	798 1912 1892;	799 1912 1888;	800 1912 1885;	801 1912 1882;	802 1912 1878;	803 1912 1875;	804 1912 1872;	805 1912 1868;	806 1912 1865;	807 1912 1862;	808 1912 1858;	809 1912 1855;	810 1912 1852;	811 1912 1849;	812 1912 1845;	813 1912 1842;	814 1912 1839;	815 1912 1836;	816 1912 1832;	817 1912 1829;	818 1912 1826;	819 1912 1823;	820 1912 1819;	821 1912 1816;	822 1912 1813;	823 1912 1810;	824 1912 1807;	825 1912 1803;	826 1912 1800;	827 1912 1797;	828 1912 1794;	829 1912 1791;	830 1912 1788;	831 1912 1784;	832 1912 1781;	833 1912 1778;	834 1912 1775;	835 1912 1772;	836 1912 1769;	837 1912 1766;	838 1912 1763;	839 1912 1759;	840 1912 1756;	841 1912 1753;	842 1912 1750;	843 1912 1747;	844 1912 1744;	845 1912 1741;	846 1912 1738;	847 1912 1735;	848 1912 1732;	849 1912 1729;	850 1912 1726;	851 1912 1723;	852 1912 1720;	853 1912 1717;	854 1912 1714;	855 1912 1711;	856 1912 1708;	857 1912 1705;	858 1912 1702;	859 1912 1699;	860 1912 1696;	861 1912 1693;	862 1912 1690;	863 1912 1687;	864 1912 1684;	865 1912 1681;	866 1912 1678;	867 1912 1675;	868 1912 1672;	869 1912 1669;	870 1912 1666;	871 1912 1663;	872 1912 1660;	873 1912 1658;	874 1912 1655;	875 1912 1652;	876 1912 1649;	877 1912 1646;	878 1912 1643;	879 1912 1640;	880 1912 1637;	881 1912 1635;	882 1912 1632;	883 1912 1629;	884 1912 1626;	885 1912 1623;	886 1912 1620;	887 1912 1618;	888 1912 1615;	889 1912 1612;	890 1912 1609;	891 1912 1606;	892 1912 1603;	893 1912 1601;	894 1912 1598;	895 1912 1595;	896 1912 1592;	897 1912 1590;	898 1912 1587;	899 1912 1584;	900 1912 1581;	901 1912 1579;	902 1912 1576;	903 1912 1573;	904 1912 1570;	905 1912 1568;	906 1912 1565;	907 1912 1562;	908 1912 1559;	909 1912 1557;	910 1912 1554;	911 1912 1551;	912 1912 1549;	913 1912 1546;	914 1912 1543;	915 1912 1540;	916 1912 1538;	917 1912 1535;	918 1912 1532;	919 1912 1530;	920 1912 1527;	921 1912 1524;	922 1912 1522;	923 1912 1519;	924 1912 1517;	925 1912 1514;	926 1912 1511;	927 1912 1509;	928 1912 1506;	929 1912 1503;	930 1912 1501;	931 1912 1498;	932 1912 1496;	933 1912 1493;	934 1912 1490;	935 1912 1488;	936 1912 1485;	937 1912 1483;	938 1912 1480;	939 1912 1477;	940 1912 1475;	941 1912 1472;	942 1912 1470;	943 1912 1467;	944 1912 1465;	945 1912 1462;	946 1912 1460;	947 1912 1457;	948 1912 1454;	949 1912 1452;	950 1912 1449;	951 1912 1447;	952 1912 1444;	953 1912 1442;	954 1912 1439;	955 1912 1437;	956 1912 1434;	957 1912 1432;	958 1912 1429;	959 1912 1427;	960 1912 1424;	961 1912 1422;	962 1912 1419;	963 1912 1417;	964 1912 1414;	965 1912 1412;	966 1912 1410;	967 1912 1407;	968 1912 1405;	969 1912 1402;	970 1912 1400;	971 1912 1397;	972 1912 1395;	973 1912 1392;	974 1912 1390;	975 1912 1388;	976 1912 1385;	977 1912 1383;	978 1912 1380;	979 1912 1378;	980 1912 1376;	981 1912 1373;	982 1912 1371;	983 1912 1368;	984 1912 1366;	985 1912 1364;	986 1912 1361;	987 1912 1359;	988 1912 1356;	989 1912 1354;	990 1912 1352;	991 1912 1349;	992 1912 1347;	993 1912 1345;	994 1912 1342;	995 1912 1340;	996 1912 1338;	997 1912 1335;	998 1912 1333;	999 1912 1331;	1000 1912 1328;	1001 1912 1326;	1002 1912 1324;	1003 1912 1321;	1004 1912 1319;	1005 1912 1317;	1006 1912 1314;	1007 1912 1312;	1008 1912 1310;	1009 1912 1307;	1010 1912 1305;	1011 1912 1303;	1012 1912 1301;	1013 1912 1298;	1014 1912 1296;	1015 1912 1294;	1016 1912 1291;	1017 1912 1289;	1018 1912 1287;	1019 1912 1285;	1020 1912 1282;	1021 1912 1280;	1022 1912 1278;	1023 1912 1276;	1024 1912 1273;	1025 1912 1271;	1026 1912 1269;	1027 1912 1267;	1028 1912 1264;	1029 1912 1262;	1030 1912 1260;	1031 1912 1258;	1032 1912 1256;	1033 1912 1253;	1034 1912 1251;	1035 1912 1249;	1036 1912 1247;	1037 1912 1245;	1038 1912 1242;	1039 1912 1240;	1040 1912 1238;	1041 1912 1236;	1042 1912 1234;	1043 1912 1231;	1044 1912 1229;	1045 1912 1227;	1046 1912 1225;	1047 1912 1223;	1048 1912 1221;	1049 1912 1218;	1050 1912 1216;	1051 1912 1214;	1052 1912 1212;	1053 1912 1210;	1054 1912 1208;	1055 1912 1205;	1056 1912 1203;	1057 1912 1201;	1058 1912 1199;	1059 1912 1197;	1060 1912 1195;	1061 1912 1193;	1062 1912 1191;	1063 1912 1188;	1064 1912 1186;	1065 1912 1184;	1066 1912 1182;	1067 1912 1180;	1068 1912 1178;	1069 1912 1176;	1070 1912 1174;	1071 1912 1172;	1072 1912 1169;	1073 1912 1167;	1074 1912 1165;	1075 1912 1163;	1076 1912 1161;	1077 1912 1159;	1078 1912 1157;	1079 1912 1155;	1080 1912 1153;	1081 1912 1151;	1082 1912 1149;	1083 1912 1147;	1084 1912 1145;	1085 1912 1143;	1086 1912 1140;	1087 1912 1138;	1088 1912 1136;	1089 1912 1134;	1090 1912 1132;	1091 1912 1130;	1092 1912 1128;	1093 1912 1126;	1094 1912 1124;	1095 1912 1122;	1096 1912 1120;	1097 1912 1118;	1098 1912 1116;	1099 1912 1114;	1100 1912 1112;	1101 1912 1110;	1102 1912 1108;	1103 1912 1106;	1104 1912 1104;	1105 1912 1102;	1106 1912 1100;	1107 1912 1098;	1108 1912 1096;	1109 1912 1094;	1110 1912 1092;	1111 1912 1090;	1112 1912 1088;	1113 1912 1086;	1114 1912 1084;	1115 1912 1082;	1116 1912 1080;	1117 1912 1078;	1118 1912 1076;	1119 1912 1074;	1120 1912 1072;	1121 1912 1070;	1122 1912 1069;	1123 1912 1067;	1124 1912 1065;	1125 1912 1063;	1126 1912 1061;	1127 1912 1059;	1128 1912 1057;	1129 1912 1055;	1130 1912 1053;	1131 1912 1051;	1132 1912 1049;	1133 1912 1047;	1134 1912 1045;	1135 1912 1043;	1136 1912 1041;	1137 1912 1040;	1138 1912 1038;	1139 1912 1036;	1140 1912 1034;	1141 1912 1032;	1142 1912 1030;	1143 1912 1028;	1144 1912 1026;	1145 1912 1024;	1146 1912 1022;	1147 1912 1021;	1148 1912 1019;	1149 1912 1017;	1150 1912 1015;	1151 1912 1013;	1152 1912 1011;	1153 1912 1009;	1154 1912 1007;	1155 1912 1005;	1156 1912 1004;	1157 1912 1002;	1158 1912 1000;	1159 1912 998;	1160 1912 996;	1161 1912 994;	1162 1912 992;	1163 1912 991;	1164 1912 989;	1165 1912 987;	1166 1912 985;	1167 1912 983;	1168 1912 981;	1169 1912 980;	1170 1912 978;	1171 1912 976;	1172 1912 974;	1173 1912 972;	1174 1912 970;	1175 1912 969;	1176 1912 967;	1177 1912 965;	1178 1912 963;	1179 1912 961;	1180 1912 959;	1181 1912 958;	1182 1912 956;	1183 1912 954;	1184 1912 952;	1185 1912 950;	1186 1912 949;	1187 1912 947;	1188 1912 945;	1189 1912 943;	1190 1912 941;	1191 1912 940;	1192 1912 938;	1193 1912 936;	1194 1912 934;	1195 1912 933;	1196 1912 931;	1197 1912 929;	1198 1912 927;	1199 1912 925;	1200 1912 924;	1201 1912 922;	1202 1912 920;	1203 1912 918;	1204 1912 917;	1205 1912 915;	1206 1912 913;	1207 1912 911;	1208 1912 910;	1209 1912 908;	1210 1912 906;	1211 1912 904;	1212 1912 903;	1213 1912 901;	1214 1912 899;	1215 1912 897;	1216 1912 896;	1217 1912 894;	1218 1912 892;	1219 1912 890;	1220 1912 889;	1221 1912 887;	1222 1912 885;	1223 1912 883;	1224 1912 882;	1225 1912 880;	1226 1912 878;	1227 1912 877;	1228 1912 875;	1229 1912 873;	1230 1912 871;	1231 1912 870;	1232 1912 868;	1233 1912 866;	1234 1912 865;	1235 1912 863;	1236 1912 861;	1237 1912 860;	1238 1912 858;	1239 1912 856;	1240 1912 855;	1241 1912 853;	1242 1912 851;	1243 1912 849;	1244 1912 848;	1245 1912 846;	1246 1912 844;	1247 1912 843;	1248 1912 841;	1249 1912 839;	1250 1912 838;	1251 1912 836;	1252 1912 834;	1253 1912 833;	1254 1912 831;	1255 1912 829;	1256 1912 828;	1257 1912 826;	1258 1912 824;	1259 1912 823;	1260 1912 821;	1261 1912 819;	1262 1912 818;	1263 1912 816;	1264 1912 815;	1265 1912 813;	1266 1912 811;	1267 1912 810;	1268 1912 808;	1269 1912 806;	1270 1912 805;	1271 1912 803;	1272 1912 801;	1273 1912 800;	1274 1912 798;	1275 1912 797;	1276 1912 795;	1277 1912 793;	1278 1912 792;	1279 1912 790;	1280 1912 788;	1281 1912 787;	1282 1912 785;	1283 1912 784;	1284 1912 782;	1285 1912 780;	1286 1912 779;	1287 1912 777;	1288 1912 776;	1289 1912 774;	1290 1912 772;	1291 1912 771;	1292 1912 769;	1293 1912 768;	1294 1912 766;	1295 1912 764;	1296 1912 763;	1297 1912 761;	1298 1912 760;	1299 1912 758;	1300 1912 756;	1301 1912 755;	1302 1912 753;	1303 1912 752;	1304 1912 750;	1305 1912 749;	1306 1912 747;	1307 1912 745;	1308 1912 744;	1309 1912 742;	1310 1912 741;	1311 1912 739;	1312 1912 738;	1313 1912 736;	1314 1912 734;	1315 1912 733;	1316 1912 731;	1317 1912 730;	1318 1912 728;	1319 1912 727;	1320 1912 725;	1321 1912 724;	1322 1912 722;	1323 1912 721;	1324 1912 719;	1325 1912 717;	1326 1912 716;	1327 1912 714;	1328 1912 713;	1329 1912 711;	1330 1912 710;	1331 1912 708;	1332 1912 707;	1333 1912 705;	1334 1912 704;	1335 1912 702;	1336 1912 701;	1337 1912 699;	1338 1912 698;	1339 1912 696;	1340 1912 695;	1341 1912 693;	1342 1912 691;	1343 1912 690;	1344 1912 688;	1345 1912 687;	1346 1912 685;	1347 1912 684;	1348 1912 682;	1349 1912 681;	1350 1912 679;	1351 1912 678;	1352 1912 676;	1353 1912 675;	1354 1912 673;	1355 1912 672;	1356 1912 670;	1357 1912 669;	1358 1912 667;	1359 1912 666;	1360 1912 664;	1361 1912 663;	1362 1912 661;	1363 1912 660;	1364 1912 659;	1365 1912 657;	1366 1912 656;	1367 1912 654;	1368 1912 653;	1369 1912 651;	1370 1912 650;	1371 1912 648;	1372 1912 647;	1373 1912 645;	1374 1912 644;	1375 1912 642;	1376 1912 641;	1377 1912 639;	1378 1912 638;	1379 1912 636;	1380 1912 635;	1381 1912 634;	1382 1912 632;	1383 1912 631;	1384 1912 629;	1385 1912 628;	1386 1912 626;	1387 1912 625;	1388 1912 623;	1389 1912 622;	1390 1912 620;	1391 1912 619;	1392 1912 618;	1393 1912 616;	1394 1912 615;	1395 1912 613;	1396 1912 612;	1397 1912 610;	1398 1912 609;	1399 1912 607;	1400 1912 606;	1401 1912 605;	1402 1912 603;	1403 1912 602;	1404 1912 600;	1405 1912 599;	1406 1912 597;	1407 1912 596;	1408 1912 595;	1409 1912 593;	1410 1912 592;	1411 1912 590;	1412 1912 589;	1413 1912 588;	1414 1912 586;	1415 1912 585;	1416 1912 583;	1417 1912 582;	1418 1912 580;	1419 1912 579;	1420 1912 578;	1421 1912 576;	1422 1912 575;	1423 1912 573;	1424 1912 572;	1425 1912 571;	1426 1912 569;	1427 1912 568;	1428 1912 566;	1429 1912 565;	1430 1912 564;	1431 1912 562;	1432 1912 561;	1433 1912 560;	1434 1912 558;	1435 1912 557;	1436 1912 555;	1437 1912 554;	1438 1912 553;	1439 1912 551;	1440 1912 550;	1441 1912 548;	1442 1912 547;	1443 1912 546;	1444 1912 544;	1445 1912 543;	1446 1912 542;	1447 1912 540;	1448 1912 539;	1449 1912 537;	1450 1912 536;	1451 1912 535;	1452 1912 533;	1453 1912 532;	1454 1912 531;	1455 1912 529;	1456 1912 528;	1457 1912 526;	1458 1912 525;	1459 1912 524;	1460 1912 522;	1461 1912 521;	1462 1912 520;	1463 1912 518;	1464 1912 517;	1465 1912 516;	1466 1912 514;	1467 1912 513;	1468 1912 512;	1469 1912 510;	1470 1912 509;	1471 1912 508;	1472 1912 506;	1473 1912 505;	1474 1912 504;	1475 1912 502;	1476 1912 501;	1477 1912 500;	1478 1912 498;	1479 1912 497;	1480 1912 496;	1481 1912 494;	1482 1912 493;	1483 1912 492;	1484 1912 490;	1485 1912 489;	1486 1912 488;	1487 1912 486;	1488 1912 485;	1489 1912 484;	1490 1912 482;	1491 1912 481;	1492 1912 480;	1493 1912 478;	1494 1912 477;	1495 1912 476;	1496 1912 474;	1497 1912 473;	1498 1912 472;	1499 1912 470;	1500 1912 469;	1501 1912 468;	1502 1912 466;	1503 1912 465;	1504 1912 464;	1505 1912 462;	1506 1912 461;	1507 1912 460;	1508 1912 459;	1509 1912 457;	1510 1912 456;	1511 1912 455;	1512 1912 453;	1513 1912 452;	1514 1912 451;	1515 1912 449;	1516 1912 448;	1517 1912 447;	1518 1912 446;	1519 1912 444;	1520 1912 443;	1521 1912 442;	1522 1912 440;	1523 1912 439;	1524 1912 438;	1525 1912 437;	1526 1912 435;	1527 1912 434;	1528 1912 433;	1529 1912 431;	1530 1912 430;	1531 1912 429;	1532 1912 428;	1533 1912 426;	1534 1912 425;	1535 1912 424;	1536 1912 422;	1537 1912 421;	1538 1912 420;	1539 1912 419;	1540 1912 417;	1541 1912 416;	1542 1912 415;	1543 1912 414;	1544 1912 412;	1545 1912 411;	1546 1912 410;	1547 1912 409;	1548 1912 407;	1549 1912 406;	1550 1912 405;	1551 1912 403;	1552 1912 402;	1553 1912 401;	1554 1912 400;	1555 1912 398;	1556 1912 397;	1557 1912 396;	1558 1912 395;	1559 1912 393;	1560 1912 392;	1561 1912 391;	1562 1912 390;	1563 1912 388;	1564 1912 387;	1565 1912 386;	1566 1912 385;	1567 1912 383;	1568 1912 382;	1569 1912 381;	1570 1912 380;	1571 1912 378;	1572 1912 377;	1573 1912 376;	1574 1912 375;	1575 1912 374;	1576 1912 372;	1577 1912 371;	1578 1912 370;	1579 1912 369;	1580 1912 367;	1581 1912 366;	1582 1912 365;	1583 1912 364;	1584 1912 362;	1585 1912 361;	1586 1912 360;	1587 1912 359;	1588 1912 358;	1589 1912 356;	1590 1912 355;	1591 1912 354;	1592 1912 353;	1593 1912 351;	1594 1912 350;	1595 1912 349;	1596 1912 348;	1597 1912 347;	1598 1912 345;	1599 1912 344;	1600 1912 343;	1601 1912 342;	1602 1912 340;	1603 1912 339;	1604 1912 338;	1605 1912 337;	1606 1912 336;	1607 1912 334;	1608 1912 333;	1609 1912 332;	1610 1912 331;	1611 1912 330;	1612 1912 328;	1613 1912 327;	1614 1912 326;	1615 1912 325;	1616 1912 324;	1617 1912 322;	1618 1912 321;	1619 1912 320;	1620 1912 319;	1621 1912 318;	1622 1912 316;	1623 1912 315;	1624 1912 314;	1625 1912 313;	1626 1912 312;	1627 1912 310;	1628 1912 309;	1629 1912 308;	1630 1912 307;	1631 1912 306;	1632 1912 304;	1633 1912 303;	1634 1912 302;	1635 1912 301;	1636 1912 300;	1637 1912 299;	1638 1912 297;	1639 1912 296;	1640 1912 295;	1641 1912 294;	1642 1912 293;	1643 1912 291;	1644 1912 290;	1645 1912 289;	1646 1912 288;	1647 1912 287;	1648 1912 286;	1649 1912 284;	1650 1912 283;	1651 1912 282;	1652 1912 281;	1653 1912 280;	1654 1912 279;	1655 1912 277;	1656 1912 276;	1657 1912 275;	1658 1912 274;	1659 1912 273;	1660 1912 272;	1661 1912 270;	1662 1912 269;	1663 1912 268;	1664 1912 267;	1665 1912 266;	1666 1912 265;	1667 1912 263;	1668 1912 262;	1669 1912 261;	1670 1912 260;	1671 1912 259;	1672 1912 258;	1673 1912 257;	1674 1912 255;	1675 1912 254;	1676 1912 253;	1677 1912 252;	1678 1912 251;	1679 1912 250;	1680 1912 248;	1681 1912 247;	1682 1912 246;	1683 1912 245;	1684 1912 244;	1685 1912 243;	1686 1912 242;	1687 1912 240;	1688 1912 239;	1689 1912 238;	1690 1912 237;	1691 1912 236;	1692 1912 235;	1693 1912 234;	1694 1912 233;	1695 1912 231;	1696 1912 230;	1697 1912 229;	1698 1912 228;	1699 1912 227;	1700 1912 226;	1701 1912 225;	1702 1912 223;	1703 1912 222;	1704 1912 221;	1705 1912 220;	1706 1912 219;	1707 1912 218;	1708 1912 217;	1709 1912 216;	1710 1912 214;	1711 1912 213;	1712 1912 212;	1713 1912 211;	1714 1912 210;	1715 1912 209;	1716 1912 208;	1717 1912 207;	1718 1912 205;	1719 1912 204;	1720 1912 203;	1721 1912 202;	1722 1912 201;	1723 1912 200;	1724 1912 199;	1725 1912 198;	1726 1912 197;	1727 1912 195;	1728 1912 194;	1729 1912 193;	1730 1912 192;	1731 1912 191;	1732 1912 190;	1733 1912 189;	1734 1912 188;	1735 1912 187;	1736 1912 185;	1737 1912 184;	1738 1912 183;	1739 1912 182;	1740 1912 181;	1741 1912 180;	1742 1912 179;	1743 1912 178;	1744 1912 177;	1745 1912 175;	1746 1912 174;	1747 1912 173;	1748 1912 172;	1749 1912 171;	1750 1912 170;	1751 1912 169;	1752 1912 168;	1753 1912 167;	1754 1912 166;	1755 1912 165;	1756 1912 163;	1757 1912 162;	1758 1912 161;	1759 1912 160;	1760 1912 159;	1761 1912 158;	1762 1912 157;	1763 1912 156;	1764 1912 155;	1765 1912 154;	1766 1912 153;	1767 1912 151;	1768 1912 150;	1769 1912 149;	1770 1912 148;	1771 1912 147;	1772 1912 146;	1773 1912 145;	1774 1912 144;	1775 1912 143;	1776 1912 142;	1777 1912 141;	1778 1912 140;	1779 1912 138;	1780 1912 137;	1781 1912 136;	1782 1912 135;	1783 1912 134;	1784 1912 133;	1785 1912 132;	1786 1912 131;	1787 1912 130;	1788 1912 129;	1789 1912 128;	1790 1912 127;	1791 1912 126;	1792 1912 125;	1793 1912 123;	1794 1912 122;	1795 1912 121;	1796 1912 120;	1797 1912 119;	1798 1912 118;	1799 1912 117;	1800 1912 116;	1801 1912 115;	1802 1912 114;	1803 1912 113;	1804 1912 112;	1805 1912 111;	1806 1912 110;	1807 1912 109;	1808 1912 107;	1809 1912 106;	1810 1912 105;	1811 1912 104;	1812 1912 103;	1813 1912 102;	1814 1912 101;	1815 1912 100;	1816 1912 99;	1817 1912 98;	1818 1912 97;	1819 1912 96;	1820 1912 95;	1821 1912 94;	1822 1912 93;	1823 1912 92;	1824 1912 91;	1825 1912 90;	1826 1912 89;	1827 1912 87;	1828 1912 86;	1829 1912 85;	1830 1912 84;	1831 1912 83;	1832 1912 82;	1833 1912 81;	1834 1912 80;	1835 1912 79;	1836 1912 78;	1837 1912 77;	1838 1912 76;	1839 1912 75;	1840 1912 74;	1841 1912 73;	1842 1912 72;	1843 1912 71;	1844 1912 70;	1845 1912 69;	1846 1912 68;	1847 1912 67;	1848 1912 66;	1849 1912 65;	1850 1912 64;	1851 1912 62;	1852 1912 61;	1853 1912 60;	1854 1912 59;	1855 1912 58;	1856 1912 57;	1857 1912 56;	1858 1912 55;	1859 1912 54;	1860 1912 53;	1861 1912 52;	1862 1912 51;	1863 1912 50;	1864 1912 49;	1865 1912 48;	1866 1912 47;	1867 1912 46;	1868 1912 45;	1869 1912 44;	1870 1912 43;	1871 1912 42;	1872 1912 41;	1873 1912 40;	1874 1912 39;	1875 1912 38;	1876 1912 37;	1877 1912 36;	1878 1912 35;	1879 1912 34;	1880 1912 33;	1881 1912 32;	1882 1912 31;	1883 1912 30;	1884 1912 29;	1885 1912 28;	1886 1912 27;	1887 1912 26;	1888 1912 25;	1889 1912 24;	1890 1912 23;	1891 1912 22;	1892 1912 21;	1893 1912 20;	1894 1912 19;	1895 1912 18;	1896 1912 17;	1897 1912 16;	1898 1912 15;	1899 1912 14;	1900 1912 13;	1901 1912 12;	1902 1912 11;	1903 1912 10;	1904 1912 9;	1905 1912 8;	1906 1912 7;	1907 1912 6;	1908 1912 5;	1909 1912 4;	1910 1912 3;	1911 1912 2;	Answer (m, n, i, j, D) 2167 1020 2395 2395 5482660
It took 222.53819137000028 seconds.

So, we found our answer: $5482660$.

The computation wasn't fast. I liked how we could improve the upper limit on looping for k as we found better and better values for least_D. However, k_upper was never udpated! This indicates that our first found quadruple $(m, n, i, j)$ was already the answer. Could we have seen that back then?