Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/tasks/narcissistic-decimal-number/oracle.py # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / tasks / narcissistic-decimal-number / oracle.py` 13 lines ยท 676 bytes Raw Blame History 1 # Independent reference for "Narcissistic decimal number" (Python 3, standard library only). 2 # expected.txt is this program's stdout; omc never produced it. 3 # by digit multisets: for each length k and each sorted choice of k digits, the power sum is 4 # narcissistic when its own digits, sorted, are that choice 5 import itertools 6 found = set() 7 for k in range(1, 8): 8 for combo in itertools.combinations_with_replacement(range(10), k): 9 s = sum(d ** k for d in combo) 10 if len(str(s)) == k and tuple(sorted(map(int, str(s)))) == combo: 11 found.add(s) 12 found.add(0) 13 print("first 25 narcissistic decimal numbers: " + " ".join(map(str, sorted(found)[:25])))