login
A198096
n such that d(1)*1! + d(2)*2! + ... + d(k)*k! is prime, where d(i) are the decimal digits of n.
0
2, 3, 5, 7, 11, 12, 13, 15, 16, 18, 19, 20, 30, 31, 32, 34, 35, 37, 38, 50, 51, 53, 54, 56, 57, 59, 70, 72, 73, 75, 76, 78, 91, 92, 94, 95, 97, 101, 102, 103, 105, 106, 107, 110, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 139
OFFSET
1,1
EXAMPLE
139 is in the sequence because 1*1! + 3*2! + 9*3! = 1 + 6 + 54 = 61 is prime.
MAPLE
for n from 1 to 140 do :l:=length(n):n0:=n:s:=0:for m from l by -1 to 1 do:q:=n0:u:=irem(q, 10):v:=iquo(q, 10):n0:=v :s:=s+u*m!:od: if type(s, prime)=true then printf(`%d, `, n):else fi:od:
MATHEMATICA
Select[Range[200], PrimeQ[Total[IntegerDigits[#]Range[IntegerLength[#]]!]]&] (* Harvey P. Dale, Apr 12 2023 *)
PROG
(PARI) is_A198096(n)=isprime(sum(k=1, #n=Vecsmall(Str(n)), (n[k]-48)*k!)) \\ M. F. Hasler, Jan 26 2012
CROSSREFS
Cf. A198044.
Sequence in context: A242694 A117288 A117283 * A137923 A163753 A131930
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Oct 21 2011
STATUS
approved