login
A344842
Numbers with digits in nondecreasing order whose digit sum is prime and whose digit product is a perfect square > 0.
1
11, 14, 49, 111, 119, 122, 128, 133, 155, 166, 188, 199, 229, 236, 289, 368, 449, 559, 779, 1114, 1334, 1444, 1466, 1477, 1499, 2249, 2489, 3349, 4559, 4889, 4999, 11111, 11119, 11122, 11128, 11144, 11155, 11177, 11188, 11236, 11339, 11368, 11449, 11669, 11999, 12233
OFFSET
1,1
COMMENTS
Primitive sequence of A344825.
LINKS
David A. Corneth, Table of n, a(n) for n = 1..29793 (terms <= 10^15)
EXAMPLE
49 is in the sequence as its product of digits is 36 which is a perfect square > 0 and its sum of digits is 13 which is prime.
MATHEMATICA
ndoQ[n_]:=Module[{id=IntegerDigits[n]}, FreeQ[id, 0]&&Min[ Differences[id]]> = 0&&PrimeQ[Total[id]]&&IntegerQ[Sqrt[Times@@id]]]; Select[Range[ 12500], ndoQ] (* Harvey P. Dale, Jun 18 2021 *)
PROG
(Python)
from math import prod
from sympy import isprime, integer_nthroot
from itertools import combinations_with_replacement as mc
def ok(s):
d = list(map(int, s))
return '0' not in s and isprime(sum(d)) and integer_nthroot(prod(d), 2)[1]
def auptod(digits): return [int("".join(p)) for d in range(2, digits+1) for p in mc("123456789", d) if ok("".join(p))]
print(auptod(5)) # Michael S. Branicky, May 29 2021
(PARI) uptoqdigits(n) = { my(res = List()); for(j = 2, n, forvec(x = vector(j, i, [1, 9]), if(issquare(vecprod(x)) && isprime(vecsum(x)), listput(res, fromdigits(x)) ) , 1 ) ); res }
CROSSREFS
Sequence in context: A344825 A371072 A371073 * A101840 A061087 A063964
KEYWORD
nonn,base
AUTHOR
David A. Corneth, May 29 2021
EXTENSIONS
Definition (Name) corrected by Harvey P. Dale, Jun 18 2021
STATUS
approved