<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://simia.net/index.php?action=history&amp;feed=atom&amp;title=Unique_digits_addition_-_ChatGPT</id>
	<title>Unique digits addition - ChatGPT - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://simia.net/index.php?action=history&amp;feed=atom&amp;title=Unique_digits_addition_-_ChatGPT"/>
	<link rel="alternate" type="text/html" href="http://simia.net/index.php?title=Unique_digits_addition_-_ChatGPT&amp;action=history"/>
	<updated>2026-05-15T13:50:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://simia.net/index.php?title=Unique_digits_addition_-_ChatGPT&amp;diff=2679&amp;oldid=prev</id>
		<title>Denny: Created page with &quot;&lt;pre&gt; def all_solutions_at_most_once():     sols = set()     from functools import lru_cache     for la in range(1,6):         for lb in range(1,6):             for lc in [max...&quot;</title>
		<link rel="alternate" type="text/html" href="http://simia.net/index.php?title=Unique_digits_addition_-_ChatGPT&amp;diff=2679&amp;oldid=prev"/>
		<updated>2025-08-24T08:08:24Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; def all_solutions_at_most_once():     sols = set()     from functools import lru_cache     for la in range(1,6):         for lb in range(1,6):             for lc in [max...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
def all_solutions_at_most_once():&lt;br /&gt;
    sols = set()&lt;br /&gt;
    from functools import lru_cache&lt;br /&gt;
    for la in range(1,6):&lt;br /&gt;
        for lb in range(1,6):&lt;br /&gt;
            for lc in [max(la,lb), max(la,lb)+1]:&lt;br /&gt;
                if lc&amp;lt;1 or lc&amp;gt;5: continue&lt;br /&gt;
                if la+lb+lc &amp;gt; 10: continue&lt;br /&gt;
                @lru_cache(None)&lt;br /&gt;
                def dfs(k, carry, used_mask, a_digits_tuple, b_digits_tuple, c_digits_tuple):&lt;br /&gt;
                    if k == lc:&lt;br /&gt;
                        if carry == 0 and len(a_digits_tuple)==la and len(b_digits_tuple)==lb and len(c_digits_tuple)==lc:&lt;br /&gt;
                            A = int(''.join(str(d) for d in reversed(a_digits_tuple)))&lt;br /&gt;
                            B = int(''.join(str(d) for d in reversed(b_digits_tuple)))&lt;br /&gt;
                            C = int(''.join(str(d) for d in reversed(c_digits_tuple)))&lt;br /&gt;
                            sols.add((A,B,C))&lt;br /&gt;
                            return 1&lt;br /&gt;
                        return 0&lt;br /&gt;
                    a_has = 1 if k&amp;lt;la else 0&lt;br /&gt;
                    b_has = 1 if k&amp;lt;lb else 0&lt;br /&gt;
                    a_iter = range(1,10) if a_has and k==la-1 else (range(10) if a_has else [-1])&lt;br /&gt;
                    b_iter = range(1,10) if b_has and k==lb-1 else (range(10) if b_has else [-1])&lt;br /&gt;
                    total = 0&lt;br /&gt;
                    for a_d in a_iter:&lt;br /&gt;
                        if a_d != -1 and ((used_mask&amp;gt;&amp;gt;a_d)&amp;amp;1): &lt;br /&gt;
                            continue&lt;br /&gt;
                        for b_d in b_iter:&lt;br /&gt;
                            if b_d != -1:&lt;br /&gt;
                                if ((used_mask&amp;gt;&amp;gt;b_d)&amp;amp;1) or b_d==a_d:&lt;br /&gt;
                                    continue&lt;br /&gt;
                            s = carry + (0 if a_d==-1 else a_d) + (0 if b_d==-1 else b_d)&lt;br /&gt;
                            c_d = s % 10&lt;br /&gt;
                            c_carry = s // 10&lt;br /&gt;
                            if (used_mask&amp;gt;&amp;gt;c_d)&amp;amp;1 or c_d==a_d or c_d==b_d:&lt;br /&gt;
                                continue&lt;br /&gt;
                            if k==lc-1 and c_d==0:&lt;br /&gt;
                                continue&lt;br /&gt;
                            new_mask = used_mask | ((0 if a_d==-1 else (1&amp;lt;&amp;lt;a_d)) | (0 if b_d==-1 else (1&amp;lt;&amp;lt;b_d)) | (1&amp;lt;&amp;lt;c_d))&lt;br /&gt;
                            total += dfs(k+1, c_carry, new_mask, a_digits_tuple + (() if a_d==-1 else (a_d,)), b_digits_tuple + (() if b_d==-1 else (b_d,)), c_digits_tuple + (c_d,))&lt;br /&gt;
                    return total&lt;br /&gt;
                dfs(0,0,0, tuple(), tuple(), tuple())&lt;br /&gt;
    return sols&lt;br /&gt;
&lt;br /&gt;
sols_at_most = all_solutions_at_most_once()&lt;br /&gt;
print(len(sols_at_most))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Denny</name></author>
		
	</entry>
</feed>