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.

Showing 1-3 of 3 results.

A052034 Primes such that the sum of the squares of their digits is also a prime.

Original entry on oeis.org

11, 23, 41, 61, 83, 101, 113, 131, 137, 173, 179, 191, 197, 199, 223, 229, 311, 313, 317, 331, 337, 353, 373, 379, 397, 401, 409, 443, 449, 461, 463, 467, 601, 641, 643, 647, 661, 683, 719, 733, 739, 773, 797, 829, 863, 883, 911, 919, 937, 971, 977, 991, 997, 1013
Offset: 1

Views

Author

Patrick De Geest, Dec 15 1999

Keywords

Comments

Primes p such that the sum of the squared digits of p is a prime q. For the values of q see A109181.

Examples

			p = 23 is in the sequence because q = 2^2 + 3^2 = 13 is a prime.
9431 -> 9^2 + 4^2 + 3^2 + 1^2 = 107 (which is prime).
		

References

  • Clifford A. Pickover, A Passion for Mathematics, John Wiley & Sons, Inc., 2005, p. 89.
  • Charles W. Trigg, Journal of Recreational Mathematics, Vol. 20(2), 1988.

Crossrefs

Programs

  • Maple
    a:=proc(n) local nn, L: nn:=convert(n,base,10): L:=nops(nn): if isprime(n)= true and isprime(add(nn[j]^2,j=1..L))=true then n else end if end proc: seq(a(n),n=1..1000); # Emeric Deutsch, Jan 08 2008
  • Mathematica
    Select[Prime[Range[250]],PrimeQ[Total[IntegerDigits[#]^2]]&]  (* Harvey P. Dale, Dec 19 2010 *)
  • Python
    from sympy import isprime, primerange
    def ok(p): return isprime(sum(int(d)**2 for d in str(p)))
    def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]
    print(aupto(1013)) # Michael S. Branicky, Nov 23 2021

Extensions

Edited by N. J. A. Sloane, Dec 15 2007 and again on Dec 05 2008 at the suggestion of Zak Seidov

A176179 Primes such that the sum of digits, the sum of the squares of digits and the sum of 3rd powers of their digits is also a prime.

Original entry on oeis.org

11, 101, 113, 131, 199, 223, 311, 337, 353, 373, 449, 461, 463, 641, 643, 661, 733, 829, 883, 919, 991, 1013, 1031, 1103, 1301, 1439, 1451, 1471, 1493, 1499, 1697, 1741, 1949, 2089, 2111, 2203, 2333, 2441, 2557, 3011, 3037, 3307, 3323, 3347, 3491, 3583, 3637, 3659, 3673, 3853, 4049, 4111, 4139, 4241, 4337, 4373, 4391, 4409
Offset: 1

Views

Author

Michel Lagneau, Apr 10 2010

Keywords

Comments

See A091365 for the exceptions for the case where the sum of the digits of p is not prime, but the sum of the cubes of the digits of p is prime.

Examples

			For the prime number n =5693 we obtain :
5 + 6 + 9 + 3 = 23 ;
5^2 + 6^2 + 9^2 + 3^2 = 151 ;
5^3 + 6^3 + 9^3 + 3^3 = 1097.
		

References

  • Charles W. Trigg, Journal of Recreational Mathematics, Vol. 20(2), 1988.

Crossrefs

Programs

  • Maple
    with(numtheory):for n from 2 to 10000 do:l:=evalf(floor(ilog10(n))+1):n0:=n:s1:=0:s2:=0:s3:=0:for m from 1 to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v :s1:=s1+u:s2:=s2+u^2:s3:=s3+u^3:od:if type(n,prime)=true and type(s1,prime)=true and type(s2,prime)=true and type(s3,prime)=true then print(n):else fi:od:
  • Mathematica
    okQ[n_]:=Module[{idn=IntegerDigits[n]}, And@@PrimeQ[Total/@{idn,idn^2,idn^3}]]; Select[Prime[Range[600]],okQ]  (* Harvey P. Dale, Jan 18 2011 *)
  • Python
    from sympy import isprime, primerange
    def ok(p):
        return all(isprime(sum(int(d)**k for d in str(p))) for k in [1, 2, 3])
    def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]
    print(aupto(4409)) # Michael S. Branicky, Nov 23 2021

Extensions

Corrected and extended by Harvey P. Dale, Jan 18 2011

A176196 Primes such that the sum of k-th powers of digits, for each of k = 1, 2, 3, and 4, is also a prime.

Original entry on oeis.org

11, 101, 113, 131, 223, 311, 353, 461, 641, 661, 883, 1013, 1031, 1103, 1301, 1439, 1451, 1471, 1493, 1697, 1741, 2111, 2203, 3011, 3347, 3491, 3659, 4139, 4337, 4373, 4391, 4733, 4931, 5303, 5639, 5693, 6197, 6359, 6719, 6791, 6917, 6971, 7411, 7433
Offset: 1

Views

Author

Michel Lagneau, Apr 11 2010

Keywords

Comments

For k = 1, 2, and 3 see A176179

Examples

			For the prime number n=14549 we obtain :
1 + 4 + 5 + 4 + 9 = 23 ;
1^2 +4^2 + 5^2 +4^2 + 9^2 = 139 ;
1^3 +4^3 + 5^3 +4^3 + 9^3 = 983 ;
1^4 +4^4 + 5^4 +4^4 + 9^4 = 7699 ;
		

References

  • Charles W. Trigg, Journal of Recreational Mathematics, Vol. 20(2), 1988.

Crossrefs

Programs

  • Maple
    with(numtheory):for n from 2 to 20000 do:l:=evalf(floor(ilog10(n))+1):n0:=n:s1:=0:s2:=0:s3:=0:s4:=0:for m from 1 to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v :s1:=s1+u:s2:=s2+u^2:s3:=s3+u^3:s4:=s4+u^4:od:if type(n,prime)=true and type(s1,prime)=true and type(s2,prime)=true and type(s3,prime)=true and type(s4,prime)=true then print(n):else fi:od:
  • Mathematica
    Select[Prime[Range[1000]],And@@PrimeQ[Total/@Table[IntegerDigits[#]^n,{n,4}]]&] (* Harvey P. Dale, Jun 16 2013 *)
  • Python
    from sympy import isprime, primerange
    def ok(p):
        return all(isprime(sum(int(d)**k for d in str(p))) for k in range(1, 5))
    def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]
    print(aupto(7443)) # Michael S. Branicky, Nov 23 2021
Showing 1-3 of 3 results.