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)
Mehrad Mahmoudian, R code to produce the sequence
Mehrad Mahmoudian, Decompositions for a(1)-a(80)
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
KEYWORD
nonn,base
AUTHOR
Bodo Zinser, Mar 05 2005
EXTENSIONS
a(30) and beyond from Mehrad Mahmoudian, Dec 16 2019
STATUS
approved