FAILURE MAP
← Case archive

FA-14931 / Numerics / Open access

Pell positive solutions: quadratic unit irrational product · case 01

The exact pell positive solutions result violates the stated contract at quadratic unit irrational product.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The quadratic unit irrational product step uses a*u+b*v instead of a*v+b*u.

VERIFIED REPAIR

Use a*v+b*u at the quadratic unit irrational product step.

Unsuccessful approach: The partial repair a*v-b*u still violates the quadratic unit irrational product invariant.

Case contract

Input [D,u,v,k], known positive fundamental solution u^2-D*v^2=1, k>=0; return first k positive solutions.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    D,u,v,k=x
    a,b=1,0
    out=[]
    for _ in range(k):
     a,b=a*u+D*b*v,a*u+b*v
     out.append([a,b])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 3, 2, 1], [[3, 2]]), ([2, 3, 2, 2], [[3, 2], [17, 12]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([2, 3, 2, 3], [[3, 2], [17, 12], [99, 70]]), ([2, 3, 2, 4], [[3, 2], [17, 12], [99, 70], [577, 408]]), ([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([2, 3, 2, 6], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]])], [([2, 3, 2, 2], [[3, 2], [17, 12]]), ([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([3, 2, 1, 8], [[2, 1], [7, 4], [26, 15], [97, 56], [362, 209], [1351, 780], [5042, 2911], [18817, 10864]]), ([5, 9, 4, 0], []), ([5, 9, 4, 1], [[9, 4]]), ([5, 9, 4, 2], [[9, 4], [161, 72]])], [([2, 3, 2, 3], [[3, 2], [17, 12], [99, 70]]), ([2, 3, 2, 8], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860], [114243, 80782], [665857, 470832]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([6, 5, 2, 7], [[5, 2], [49, 20], [485, 198], [4801, 1960], [47525, 19402], [470449, 192060], [4656965, 1901198]]), ([6, 5, 2, 8], [[5, 2], [49, 20], [485, 198], [4801, 1960], [47525, 19402], [470449, 192060], [4656965, 1901198], [46099201, 18819920]]), ([7, 8, 3, 0], []), ([7, 8, 3, 1], [[8, 3]])], [([2, 3, 2, 4], [[3, 2], [17, 12], [99, 70], [577, 408]]), ([3, 2, 1, 4], [[2, 1], [7, 4], [26, 15], [97, 56]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([10, 19, 6, 6], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764]]), ([10, 19, 6, 7], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764], [56930852179, 18003116202]]), ([10, 19, 6, 8], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764], [56930852179, 18003116202], [2161873163521, 683644320912]]), ([11, 10, 3, 0], [])], [([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([3, 2, 1, 7], [[2, 1], [7, 4], [26, 15], [97, 56], [362, 209], [1351, 780], [5042, 2911]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([12, 7, 2, 5], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658]]), ([12, 7, 2, 6], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780]]), ([12, 7, 2, 7], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780], [50843527, 14677262]]), ([12, 7, 2, 8], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780], [50843527, 14677262], [708158977, 204427888]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
explicit oracle 0[[3, 3]][[3, 2]]Failed
explicit oracle 1[[3, 3], [21, 15]][[3, 2], [17, 12]]Failed
explicit oracle 2[][]Passed
explicit oracle 3[[649, 649], [1939861, 538021], [2517938929, 1355813569], [4806746116381, 1878188807341], [7514540038709209, 3457652214852649], [12967842667877475301, 5499313883795753461], [21284524379534544569089, 9406006390535717093329], [35823711276171497423728621, 15506737472614348502137981]][[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]Failed
explicit oracle 4[[3, 3], [21, 15], [123, 93]][[3, 2], [17, 12], [99, 70]]Failed
explicit oracle 5[[3, 3], [21, 15], [123, 93], [741, 555]][[3, 2], [17, 12], [99, 70], [577, 408]]Failed
explicit oracle 6[[3, 3], [21, 15], [123, 93], [741, 555], [4443, 3333]][[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]Failed
explicit oracle 7[[3, 3], [21, 15], [123, 93], [741, 555], [4443, 3333], [26661, 19995]][[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]]Failed

SHA-256 / b94c24721accaf4f25a69616b445b476bd0d52cd788bf74183b132d729f4f63b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    D,u,v,k=x
    a,b=1,0
    out=[]
    for _ in range(k):
     a,b=a*u+D*b*v,a*v-b*u
     out.append([a,b])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 3, 2, 1], [[3, 2]]), ([2, 3, 2, 2], [[3, 2], [17, 12]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([2, 3, 2, 3], [[3, 2], [17, 12], [99, 70]]), ([2, 3, 2, 4], [[3, 2], [17, 12], [99, 70], [577, 408]]), ([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([2, 3, 2, 6], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]])], [([2, 3, 2, 2], [[3, 2], [17, 12]]), ([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([3, 2, 1, 8], [[2, 1], [7, 4], [26, 15], [97, 56], [362, 209], [1351, 780], [5042, 2911], [18817, 10864]]), ([5, 9, 4, 0], []), ([5, 9, 4, 1], [[9, 4]]), ([5, 9, 4, 2], [[9, 4], [161, 72]])], [([2, 3, 2, 3], [[3, 2], [17, 12], [99, 70]]), ([2, 3, 2, 8], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860], [114243, 80782], [665857, 470832]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([6, 5, 2, 7], [[5, 2], [49, 20], [485, 198], [4801, 1960], [47525, 19402], [470449, 192060], [4656965, 1901198]]), ([6, 5, 2, 8], [[5, 2], [49, 20], [485, 198], [4801, 1960], [47525, 19402], [470449, 192060], [4656965, 1901198], [46099201, 18819920]]), ([7, 8, 3, 0], []), ([7, 8, 3, 1], [[8, 3]])], [([2, 3, 2, 4], [[3, 2], [17, 12], [99, 70], [577, 408]]), ([3, 2, 1, 4], [[2, 1], [7, 4], [26, 15], [97, 56]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([10, 19, 6, 6], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764]]), ([10, 19, 6, 7], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764], [56930852179, 18003116202]]), ([10, 19, 6, 8], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764], [56930852179, 18003116202], [2161873163521, 683644320912]]), ([11, 10, 3, 0], [])], [([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([3, 2, 1, 7], [[2, 1], [7, 4], [26, 15], [97, 56], [362, 209], [1351, 780], [5042, 2911]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([12, 7, 2, 5], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658]]), ([12, 7, 2, 6], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780]]), ([12, 7, 2, 7], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780], [50843527, 14677262]]), ([12, 7, 2, 8], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780], [50843527, 14677262], [708158977, 204427888]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
explicit oracle 0[[3, 2]][[3, 2]]Passed
explicit oracle 1[[3, 2], [17, 0]][[3, 2], [17, 12]]Failed
explicit oracle 2[][]Passed
explicit oracle 3[[649, 180], [842401, 0], [546718249, 151632180], [709639444801, 0], [460555999675849, 127735100064180], [597800977939807201, 0], [387972834682934873449, 107604176029165296180], [503588141617471525929601, 0]][[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]Failed
explicit oracle 4[[3, 2], [17, 0], [51, 34]][[3, 2], [17, 12], [99, 70]]Failed
explicit oracle 5[[3, 2], [17, 0], [51, 34], [289, 0]][[3, 2], [17, 12], [99, 70], [577, 408]]Failed
explicit oracle 6[[3, 2], [17, 0], [51, 34], [289, 0], [867, 578]][[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]Failed
explicit oracle 7[[3, 2], [17, 0], [51, 34], [289, 0], [867, 578], [4913, 0]][[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]]Failed

SHA-256 / 87726db5dd7646a803fa593fd598aa8426094828deacde1e6dd56a72a1ea17ba

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    D,u,v,k=x
    a,b=1,0
    out=[]
    for _ in range(k):
     a,b=a*u+D*b*v,a*v+b*u
     out.append([a,b])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 3, 2, 1], [[3, 2]]), ([2, 3, 2, 2], [[3, 2], [17, 12]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([2, 3, 2, 3], [[3, 2], [17, 12], [99, 70]]), ([2, 3, 2, 4], [[3, 2], [17, 12], [99, 70], [577, 408]]), ([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([2, 3, 2, 6], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]])], [([2, 3, 2, 2], [[3, 2], [17, 12]]), ([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([3, 2, 1, 8], [[2, 1], [7, 4], [26, 15], [97, 56], [362, 209], [1351, 780], [5042, 2911], [18817, 10864]]), ([5, 9, 4, 0], []), ([5, 9, 4, 1], [[9, 4]]), ([5, 9, 4, 2], [[9, 4], [161, 72]])], [([2, 3, 2, 3], [[3, 2], [17, 12], [99, 70]]), ([2, 3, 2, 8], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860], [114243, 80782], [665857, 470832]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([6, 5, 2, 7], [[5, 2], [49, 20], [485, 198], [4801, 1960], [47525, 19402], [470449, 192060], [4656965, 1901198]]), ([6, 5, 2, 8], [[5, 2], [49, 20], [485, 198], [4801, 1960], [47525, 19402], [470449, 192060], [4656965, 1901198], [46099201, 18819920]]), ([7, 8, 3, 0], []), ([7, 8, 3, 1], [[8, 3]])], [([2, 3, 2, 4], [[3, 2], [17, 12], [99, 70], [577, 408]]), ([3, 2, 1, 4], [[2, 1], [7, 4], [26, 15], [97, 56]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([10, 19, 6, 6], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764]]), ([10, 19, 6, 7], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764], [56930852179, 18003116202]]), ([10, 19, 6, 8], [[19, 6], [721, 228], [27379, 8658], [1039681, 328776], [39480499, 12484830], [1499219281, 474094764], [56930852179, 18003116202], [2161873163521, 683644320912]]), ([11, 10, 3, 0], [])], [([2, 3, 2, 5], [[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]), ([3, 2, 1, 7], [[2, 1], [7, 4], [26, 15], [97, 56], [362, 209], [1351, 780], [5042, 2911]]), ([2, 3, 2, 0], []), ([13, 649, 180, 8], [[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]), ([12, 7, 2, 5], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658]]), ([12, 7, 2, 6], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780]]), ([12, 7, 2, 7], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780], [50843527, 14677262]]), ([12, 7, 2, 8], [[7, 2], [97, 28], [1351, 390], [18817, 5432], [262087, 75658], [3650401, 1053780], [50843527, 14677262], [708158977, 204427888]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
explicit oracle 0[[3, 2]][[3, 2]]Passed
explicit oracle 1[[3, 2], [17, 12]][[3, 2], [17, 12]]Passed
explicit oracle 2[][]Passed
explicit oracle 3[[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]][[649, 180], [842401, 233640], [1093435849, 303264540], [1419278889601, 393637139280], [1842222905266249, 510940703520900], [2391203911756701601, 663200639532988920], [3103780835237293411849, 860833919173116097260], [4028705132934095091878401, 1117361763886065161254560]]Passed
explicit oracle 4[[3, 2], [17, 12], [99, 70]][[3, 2], [17, 12], [99, 70]]Passed
explicit oracle 5[[3, 2], [17, 12], [99, 70], [577, 408]][[3, 2], [17, 12], [99, 70], [577, 408]]Passed
explicit oracle 6[[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]][[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378]]Passed
explicit oracle 7[[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]][[3, 2], [17, 12], [99, 70], [577, 408], [3363, 2378], [19601, 13860]]Passed

SHA-256 / 831fef4fccfc2ba51390ac25f5d3a3ca094e375dfc2c9b9194eaff7244c82610

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:39:21.836397+00:00.

Case digest / c451e66062ffbd2bb7b9b26b9563530d83be30889a19dd5fcfa056985199fa9e