A377012 Numbers k whose digits can be split into substrings so that the sum of these substrings raised to consecutive powers (1, 2, 3, ...) is the number k itself.
89, 135, 175, 518, 598, 1306, 1370, 1371, 1676, 2045, 2427, 3055, 5755, 5918, 9899, 11053, 24429, 88297, 135010, 234322, 255050, 255051, 360030, 360031, 494703, 512780, 517380, 568217, 767368, 779243, 785920, 785921, 788834, 819116, 931316, 986562, 998999, 1000100
Offset: 1
Examples
175 = 1^1 + 7^2 + 5^3 is a term. 5755 = 5^1 + 75^2 + 5^3 is a term. 88297 = 88^1 + 297^2 is a term. 234322 = 23^1 + 4^2 + 3^3 + 22^4 is a term.
Programs
-
Python
import itertools analys = range(1, 7) # increase this if you want for limite in analys: numbers = range(pow(10,limite-1),pow(10,limite)) r = range(1, limite+1) disp_temp = [] for s in r: disp = list(itertools.product(r, repeat=s+1)) disp_temp.extend(disp) disp_ok = [d for d in disp_temp if sum(d)==limite] for numero in numbers: str_numero = str(numero) for combo in disp_ok: k = limite totale = 0 for c in range(len(combo), 0, -1): partenza = k-combo[c-1] porzione = str_numero[partenza:k] if c == 1: totale = totale + int(porzione) else: totale = totale + pow(int(porzione),c) k = k - combo[c-1] if totale == numero: print(numero)
Comments