login
A104113
Numbers which when chopped into one, two or more parts, added and squared result in the same number.
2
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,3
COMMENTS
Every term is congruent to 0 or 1 modulo 9. - Andrea Tarantini, Sep 27 2021
LINKS
John Drake, Table of n, a(n) for n = 1..408 (terms 1..80 from Mehrad Mahmoudian, terms 81..225 from Giovanni Resta)
Project Euler, Problem 719: Number Splitting (2020)
FORMULA
a(n) = A038206(n)^2. - Andrea Tarantini, Sep 27 2021
EXAMPLE
1296 is a term since (1+29+6)^2 = 36^2 = 1296.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A068834 A067521 A117686 * A102766 A256349 A202002
KEYWORD
nonn,base
AUTHOR
Bodo Zinser, Mar 05 2005
EXTENSIONS
a(30) and beyond from Mehrad Mahmoudian, Dec 16 2019
STATUS
approved