cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A173688 Numbers m such that the sum of square of factorial of decimal digits is prime.

This page as a plain text file.
%I A173688 #17 Feb 23 2023 12:00:31
%S A173688 10,11,12,13,14,15,19,20,21,30,31,40,41,50,51,90,91,100,101,110,111,
%T A173688 123,132,133,134,135,138,143,144,147,153,156,158,165,168,169,174,177,
%U A173688 183,185,186,196,203,213,230,231,302,303,304,305,308,312,313,314,315,318,320
%N A173688 Numbers m such that the sum of square of factorial of decimal digits is prime.
%C A173688 Let the decimal expansion of m = d(0)d(1)...d(p). Numbers such that Sum_{k=0..p} (d(k)!)^2 is prime.
%H A173688 Jinyuan Wang, <a href="/A173688/b173688.txt">Table of n, a(n) for n = 1..6821</a>
%e A173688 a(5) = 14 is in the sequence because (1!)^2 + (4!)^2 = 1 + 24^2 = 577 and 577 is prime.
%p A173688 with(numtheory):for n from 1 to 500 do:l:=length(n):n0:=n:s:=0:for m from 1
%p A173688   to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v :s:=s+(u!)^2:od: if type(s,prime)=true
%p A173688   then printf(`%d, `,n):else fi:od:
%t A173688 Select[Range[400],PrimeQ[Total[(IntegerDigits[#]!)^2]]&]  (* _Harvey P. Dale_, Mar 23 2011 *)
%o A173688 (Python)
%o A173688 from itertools import count, islice, combinations_with_replacement
%o A173688 from math import factorial
%o A173688 from sympy import isprime
%o A173688 from sympy.utilities.iterables import multiset_permutations
%o A173688 def A173688_gen(): # generator of terms
%o A173688     for l in count(0):
%o A173688         for i in range(1,10):
%o A173688             fi = factorial(i)**2
%o A173688             yield from sorted(int(str(i)+''.join(map(str,k))) for j in combinations_with_replacement(range(10), l) for k in multiset_permutations(j) if isprime(fi+sum(map(lambda n:factorial(n)**2,j))))
%o A173688 A173688_list = list(islice(A173688_gen(),50)) # _Chai Wah Wu_, Feb 23 2023
%Y A173688 Cf. A165451, A173687, A173689.
%K A173688 nonn,base
%O A173688 1,1
%A A173688 _Michel Lagneau_, Nov 25 2010