OFFSET
1,4
FORMULA
If n is square, then a(n) >= n.
EXAMPLE
a(4) = 121 though 4 itself is a square. a(7) = 25 (16 is also a square).
PROG
(Python)
from collections import Counter
from operator import itemgetter
from sympy.ntheory.primetest import is_square
from sympy.utilities.iterables import partitions, multiset_permutations
def A079842(n):
smax, m = 0, 0
for s, p in sorted(partitions(n, size=True), key=itemgetter(0), reverse=True):
if s<smax:
break
for a in multiset_permutations(Counter(p).elements()):
if is_square(k:=int(''.join(str(d) for d in a))):
m = max(k, m)
if m>0:
smax=s
return m # Chai Wah Wu, Feb 20 2024
CROSSREFS
KEYWORD
base,more,nonn
AUTHOR
Amarnath Murthy, Feb 16 2003
EXTENSIONS
More terms from Michel ten Voorde Jun 20 2003
a(23)-a(32) from Chai Wah Wu, Feb 20 2024
a(33)-a(34) from Chai Wah Wu, Feb 21 2024
STATUS
approved