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.

A371352 Prime numbers such that the sum of their prime digits is equal to the sum of their nonprime digits.

This page as a plain text file.
%I A371352 #17 Apr 23 2024 08:10:54
%S A371352 167,211,541,617,761,853,1021,1201,1423,1559,1607,1973,2011,2143,2341,
%T A371352 2383,2833,3467,3719,3823,3917,4051,4231,4637,4673,5261,5443,5519,
%U A371352 5591,6473,6521,6701,7193,7643,7687,7867,8053,8233,8677,9137,9173,9371,9551
%N A371352 Prime numbers such that the sum of their prime digits is equal to the sum of their nonprime digits.
%H A371352 Michael S. Branicky, <a href="/A371352/b371352.txt">Table of n, a(n) for n = 1..10000</a>
%e A371352 9173 is a term because it is a prime number whose prime digits and nonprime digits have the same sum: 3 + 7 = 1 + 9 = 10.
%t A371352 Select[Prime[Range[1200]], Plus @@ Select[d = IntegerDigits[#], PrimeQ[#1] &] == Plus @@ Select[d, ! PrimeQ[#1] &] &] (* _Amiram Eldar_, Mar 22 2024 *)
%o A371352 (Python)
%o A371352 from sympy import isprime
%o A371352 def ok(n):
%o A371352     if not isprime(n): return False
%o A371352     s, sums = str(n), [0, 0]
%o A371352     for c in s: sums[int(c in "2357")] += int(c)
%o A371352     return sums[0] == sums[1]
%o A371352 print([k for k in range(10**4) if ok(k)]) # _Michael S. Branicky_, Apr 23 2024
%Y A371352 Cf. A000040, A156343 (equal number of prime and nonprime digits).
%K A371352 nonn,base
%O A371352 1,1
%A A371352 _Gonzalo Martínez_, Mar 19 2024