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.

A167631 Emirps A006567 with a sum of digits and a number of digits which are both primes.

Original entry on oeis.org

113, 157, 179, 199, 311, 337, 359, 733, 739, 751, 937, 953, 971, 991, 10039, 10079, 10091, 10253, 10273, 10321, 10343, 10453, 10457, 10459, 10499, 10613, 10639, 10651, 10781, 10853, 10859, 10891, 10909, 11003, 11083, 11159, 11197, 11243
Offset: 1

Views

Author

Claudio Meller, Nov 07 2009

Keywords

Comments

Subsequence of A006567 and A028834. - R. J. Mathar, Nov 12 2009

Examples

			113 and 311 are distinct primes, and 3 (number of digits) and 5 (1+1+3) are also primes.
		

Programs

  • PARI
    sod(n)=my(s=0);while(n>9,s+=n%10;n\=10);s+n
    R(n)=my(v=eval(Vec(Str(n))),s=0);forstep(i=#v,1,-1,s=10*s+v[i]);s
    isA167631(n)=my(r); isprime(#Str(n)) && isprime(sod(n)) && isprime(n) && isprime(r=R(n)) && n!=r \\ Charles R Greathouse IV, Nov 10 2009
    
  • Python
    from sympy import primerange, isprime
    A167631 =[]
    for power_of_ten in [2,3,5]: # (7 can be added (12 sec. and 26790 terms), 11 not recommended)
        primes = list(primerange(10**(power_of_ten-1),10**power_of_ten))
        for p in primes:
            if str(p) != (p_rev:=str(p)[::-1]):
                if isprime(int(p_rev)):
                    if isprime(sum(list(map(int, p_rev.strip())))): A167631.append(p)
    print(A167631) # Karl-Heinz Hofmann, Feb 19 2025

Extensions

Edited by Charles R Greathouse IV and R. J. Mathar, Nov 10 2009