%I #13 Jan 03 2016 02:26:49
%S 2295,29625,869227,24612989369,989252839643,475851922819895,
%T 2766613478748294,383649822198994888719136,
%U 753247689895391625667326763984815199
%N Numbers n such that if you multiply the primes that are indexed by the digits of n and add the sum of digits of n you get n.
%C As prime(0) is not defined, n may not contain any zero digits.
%C a(10) > 10^40. - _Max Alekseyev_, Feb 08 2010
%e 2295 is in the sequence because prime(2)*prime(2)*prime(9)*prime(5) + sum of digits of 2295 = 3*3*23*11 + (2+2+9+5) = 2277 + 18 = 2295.
%t fQ[n_] := ! MemberQ[IntegerDigits@n, 0] && Times @@ Prime@ IntegerDigits@n + Plus @@ IntegerDigits@n == n; Do[ If[fQ@n, Print@n], {n, 2*10^9}]
%o (PARI) { a(m) = forvec(v=vector(8,i,[0,m]), u=vector(9,i, if(i<9,v[i],m)-if(i>1,v[i-1],0) ); t=prod(i=1,9,prime(i)^u[i])+sum(i=1,9,u[i]*i); s=eval(Vec(Str(t))); if(#s!=m,next); w=vector(9); for(j=1,#s, if(s[j], w[s[j]]++)); if(u==w, print(t)), 1) } /* m is the length */ \\ _Max Alekseyev_, Feb 08 2010
%o (Python)
%o from operator import mul
%o from functools import reduce
%o from itertools import combinations_with_replacement
%o A123911_list, plist = [], [0]+[prime(i) for i in range(1,10)]
%o for l in range(1,30):
%o L = 10**(l-1)
%o H = 10*L
%o for c in combinations_with_replacement(range(1,10),l):
%o n = reduce(mul,[plist[i] for i in c]) + sum(c)
%o if L <= n < H and sorted(int(d) for d in str(n)) == list(c):
%o A123911_list.append(n) # _Chai Wah Wu_, Jan 02 2016
%K base,more,nonn
%O 1,1
%A _Tanya Khovanova_, Oct 28 2006
%E a(4) and a(5) from _Donovan Johnson_, Apr 22 2008
%E a(6)-a(9) from _Max Alekseyev_, Feb 08 2010
|