A104113 Numbers which when chopped into one, two or more parts, added and squared result in the same number.
0, 1, 81, 100, 1296, 2025, 3025, 6724, 8281, 9801, 10000, 55225, 88209, 136161, 136900, 143641, 171396, 431649, 455625, 494209, 571536, 627264, 826281, 842724, 893025, 929296, 980100, 982081, 998001, 1000000, 1679616, 2896804, 3175524, 4941729, 7441984
Offset: 1
Examples
1296 is a term since (1+29+6)^2 = 36^2 = 1296.
Links
- John Drake, Table of n, a(n) for n = 1..408 (terms 1..80 from Mehrad Mahmoudian, terms 81..225 from Giovanni Resta)
- Mehrad Mahmoudian, R code to produce the sequence
- Mehrad Mahmoudian, Decompositions for a(1)-a(80)
- Project Euler, Problem 719: Number Splitting (2020)
Programs
-
Mathematica
Join[{0},Select[Select[Range@3000^2,Mod[#,9]<2&],(n=#;MemberQ[(Total/@(FromDigits/@#&/@Union[DeleteCases[SplitBy[#,#==-1&],{-1}]&/@(Insert[IntegerDigits@n,-1,#]&/@(List/@#&/@Rest@Subsets[Range@IntegerLength@n]))]))^2,#])&]] (* Giorgos Kalogeropoulos, Oct 28 2021 *)
-
Python
def expr(t, d): # can you express target t with digits d, only adding +'s if t < 0: return False if t == int(d): return True return any(expr(t-int(d[:i]), d[i:]) for i in range(1, len(d))) def aupto(limit): alst, k, k2 = [], 0, 0 while k2 <= limit: if expr(k, str(k2)): alst.append(k2) k, k2 = k+1, k2 + 2*k + 1 return alst print(aupto(7500000)) # Michael S. Branicky, Sep 27 2021
Formula
a(n) = A038206(n)^2. - Andrea Tarantini, Sep 27 2021
Extensions
a(30) and beyond from Mehrad Mahmoudian, Dec 16 2019
Comments