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-10 of 17 results. Next

A109181 a(n) = A003132(A052034(n)).

Original entry on oeis.org

2, 13, 17, 37, 73, 2, 11, 11, 59, 59, 131, 83, 131, 163, 17, 89, 11, 19, 59, 19, 67, 43, 67, 139, 139, 17, 97, 41, 113, 53, 61, 101, 37, 53, 61, 101, 73, 109, 131, 67, 139, 107, 179, 149, 109, 137, 83, 163, 139, 131, 179, 163, 211, 11, 83, 11, 19, 83, 131, 11, 83, 47, 67, 103, 11, 19, 59, 47, 107, 43, 67, 107, 179, 47, 127, 167, 199, 131, 67, 163
Offset: 1

Views

Author

Zak Seidov, Jun 21 2005

Keywords

Comments

For the primes p see A052034.

Examples

			q=13 is a term because 13 = 2^2 + 3^2 and merging digits 2 and 3 makes p=23, which is a prime.
		

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 add(nn[j]^2,j=1..L) else end if end proc: seq(a(n),n=1..1200); # Emeric Deutsch, Jan 08 2008

Formula

a(n) = A003132(A052034(n)). - Zak Seidov, Dec 30 2013

Extensions

More terms from Emeric Deutsch and Alvin Hoover Belt, Jan 08 2008

A083444 Erroneous duplicate of A052034.

Original entry on oeis.org

23, 41, 61, 83, 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

Keywords

A003132 Sum of squares of digits of n.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 2, 5, 10, 17, 26, 37, 50, 65, 82, 4, 5, 8, 13, 20, 29, 40, 53, 68, 85, 9, 10, 13, 18, 25, 34, 45, 58, 73, 90, 16, 17, 20, 25, 32, 41, 52, 65, 80, 97, 25, 26, 29, 34, 41, 50, 61, 74, 89, 106, 36, 37, 40, 45, 52, 61, 72, 85, 100, 117, 49
Offset: 0

Views

Author

Keywords

Comments

It is easy to show that a(n) < 81*(log_10(n)+1). - Stefan Steinerberger, Mar 25 2006
It is known that a(0)=0 and a(1)=1 are the only fixed points of this map. For more information about iterations of this map, see A007770, A099645 and A000216 ff. - M. F. Hasler, May 24 2009
Also known as the "Happy number map", since happy numbers A007770 are those whose trajectory under iterations of this map ends at 1. - M. F. Hasler, Jun 03 2025

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Hugo Steinhaus, One Hundred Problems in Elementary Mathematics, Dover New York, 1979, republication of English translation of Sto Zadań, Basic Books, New York, 1964. Chapter I.2, An interesting property of numbers, pp. 11-12 (available on Google Books).

Crossrefs

Concerning iterations of this map, see A003621, A039943, A099645, A031176, A007770, A000216 (starting with 2), A000218 (starting with 3), A080709 (starting with 4, this is the only nontrivial limit cycle), A000221 (starting with 5), A008460 (starting with 6), A008462 (starting with 8), A008463 (starting with 9), A139566 (starting with 15), A122065 (starting with 74169). - M. F. Hasler, May 24 2009
Cf. A080151, A051885 (record values and where they occur).

Programs

  • Haskell
    a003132 0 = 0
    a003132 x = d ^ 2 + a003132 x' where (x', d) = divMod x 10
    -- Reinhard Zumkeller, May 10 2015, Aug 07 2012, Jul 10 2011
    
  • Magma
    [0] cat [&+[d^2: d in Intseq(n)]: n in [1..80]]; // Bruno Berselli, Feb 01 2013
    
  • Maple
    A003132 := proc(n) local d; add(d^2,d=convert(n,base,10)) ; end proc: # R. J. Mathar, Oct 16 2010
  • Mathematica
    Table[Sum[DigitCount[n][[i]]*i^2, {i, 1, 9}], {n, 0, 40}] (* Stefan Steinerberger, Mar 25 2006 *)
    Total/@(IntegerDigits[Range[0,80]]^2) (* Harvey P. Dale, Jun 20 2011 *)
  • PARI
    A003132(n)=norml2(digits(n)) \\ M. F. Hasler, May 24 2009, updated Apr 12 2015
    
  • Python
    def A003132(n): return sum(int(d)**2 for d in str(n)) # Chai Wah Wu, Apr 02 2021

Formula

a(n) = n^2 - 20*n*floor(n/10) + 81*(Sum_{k>0} floor(n/10^k)^2) + 20*Sum_{k>0} floor(n/10^k)*(floor(n/10^k) - floor(n/10^(k+1))). - Hieronymus Fischer, Jun 17 2007
a(10n+k) = a(n)+k^2, 0 <= k < 10. - Hieronymus Fischer, Jun 17 2007
a(n) = A007953(A048377(n)) - A007953(n). - Reinhard Zumkeller, Jul 10 2011

Extensions

More terms from Stefan Steinerberger, Mar 25 2006
Terms checked using the given PARI code, M. F. Hasler, May 24 2009
Replaced the Maple program with a version which works also for arguments with >2 digits, R. J. Mathar, Oct 16 2010
Added ref to Porges. Steinhaus also treated iterations of this function in his Polish book Sto zadań, but I don't have access to it. - Don Knuth, Sep 07 2015

A108662 Numbers whose sum of squares of digits is a prime.

Original entry on oeis.org

11, 12, 14, 16, 21, 23, 25, 27, 32, 38, 41, 45, 49, 52, 54, 56, 58, 61, 65, 72, 78, 83, 85, 87, 94, 101, 102, 104, 106, 110, 111, 113, 119, 120, 126, 131, 133, 137, 140, 146, 159, 160, 162, 164, 166, 168, 173, 179, 186, 191, 195, 197, 199, 201, 203, 205, 207, 210
Offset: 1

Views

Author

Zak Seidov, Jun 16 2005

Keywords

Comments

If m is in the sequence, then so are 10*m and any anagram (even with adding zeros between digits) of m. E.g., 12 is a term, hence 21, 102, 120, 201, 10020 all are here.
A sequence of primitive terms is of interest. It starts with 11, 12, 14, 16, 23, 25, 27, 38, 45, 49, 56, 58, 78, 111, 113, 119, 126, 133, 137, 146, 159, 166, 168, 179, 199. Note that digits are in nondecreasing order. - Zak Seidov, Dec 31 2013

Examples

			23 is in the sequence because 2^2 + 3^2 = 13 is a prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[300],PrimeQ[Total[IntegerDigits[#]^2]]&] (* Harvey P. Dale, May 25 2012 *)
  • PARI
    isok(n) = isprime(norml2(digits(n))); \\ Michel Marcus, Jan 09 2019

A091366 Primes p such that the sum of the cubes of the digits of p is prime.

Original entry on oeis.org

11, 101, 113, 131, 139, 151, 193, 199, 223, 227, 241, 263, 269, 281, 283, 311, 337, 353, 359, 373, 421, 449, 461, 463, 487, 557, 577, 593, 599, 641, 643, 661, 733, 757, 821, 823, 827, 829, 883, 887, 919, 953, 991, 997, 1013, 1031, 1039, 1051, 1093, 1103, 1123
Offset: 1

Views

Author

Chuck Seggelin, Jan 03 2004

Keywords

Comments

Apparently, in most cases the sum of the digits of such primes is also prime, see A091365 for the exceptions.
I conjecture the contrary: the relative density of numbers in this sequence with prime digit sum is 0. - Charles R Greathouse IV, Sep 08 2010

Examples

			a(1)=11 because 1^3 + 1^3 = 2 which is prime. a(10)=227 because 2^3 + 2^3 + 7^3 = 359 which is prime.
		

Crossrefs

Cf. A046704 (primes whose digits sum to a prime) A052034 (primes whose digits squared sum to a prime) A091365 (primes whose digits cubed sum to a prime but whose digits do not sum to a prime).

Programs

  • Mathematica
    Select[Prime[Range[2, 200]], PrimeQ[Total[IntegerDigits[#]^3]]&] (* Vincenzo Librandi, Apr 13 2013 *)
  • PARI
    is(n)=my(v);if(!isprime(n),return(0));v=eval(Vec(Str(n)));isprime(sum(i=1,#v,v[i]^3)) \\ Charles R Greathouse IV, Sep 08 2010

Extensions

a(44) = 997 inserted by Charles R Greathouse IV, Sep 08 2010

A091367 Primes p such that the sum of the digits raised to the 4th power is prime.

Original entry on oeis.org

11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 113, 131, 179, 191, 197, 223, 269, 311, 313, 331, 353, 379, 397, 401, 443, 461, 601, 607, 641, 661, 719, 739, 809, 883, 911, 937, 971, 1013, 1019, 1031, 1033, 1091, 1097, 1103, 1109, 1181, 1301, 1303, 1367, 1433
Offset: 1

Views

Author

Chuck Seggelin, Jan 03 2004

Keywords

Examples

			a(1) = 11 because 1^4 + 1^4 = 2 which is prime.
a(10) = 89 because 8^4 + 9^4 = 10657 which is prime.
		

Crossrefs

Cf. A046704 (primes whose digits sum to a prime), A052034 (primes whose digits squared sum to a prime), A091366 (primes whose digits cubed sum to a prime).

Programs

  • Mathematica
    upto=500;Select[Prime[Range[upto]],PrimeQ[Total[IntegerDigits[#]^4]]&] (* Paolo Xausa, Nov 23 2021 *)
  • Python
    from sympy import isprime, primerange
    def ok(p): return isprime(sum(int(d)**4 for d in str(p)))
    def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]
    print(aupto(1433)) # Michael S. Branicky, Nov 23 2021

A052035 Palindromic primes whose sum of squared digits is also prime.

Original entry on oeis.org

11, 101, 131, 191, 313, 353, 373, 797, 919, 10301, 11311, 12721, 13331, 13931, 14341, 14741, 16361, 17971, 18181, 19391, 30103, 30703, 33533, 71317, 71917, 74747, 75557, 76367, 77977, 79397, 90709, 93139, 93739, 95959, 96769, 97379
Offset: 1

Views

Author

Patrick De Geest, Dec 15 1999

Keywords

Comments

From Bernard Schott, Oct 20 2021: (Start)
Except for 11, all terms have an odd number of digits.
Except for terms of the form 10^k+1, k >= 2, the middle digit is always odd; the unique known term of the form 10^k+1 for 2 <= k <= 100000 is 101 (see comment in A000533). (End)

Examples

			373 -> 3^2 + 7^2 + 3^2 = 67, which is prime.
		

References

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

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range[2, 10^4], And[PalindromeQ@ #, PrimeQ@ Total[IntegerDigits[#]^2]] &] (* Michael De Vlieger, Oct 20 2021 *)
  • PARI
    isok(p) = my(d=digits(p)); isprime(p) && (d==Vecrev(d)) && isprime(sum(k=1, #d, d[k]^2)); \\ Michel Marcus, Oct 17 2021
    
  • Python
    from sympy import isprime
    def ok(n):
        s = str(n)
        return s==s[::-1] and isprime(n) and isprime(sum(int(d)**2 for d in s))
    print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Nov 23 2021
    
  • Python
    # second version for going to large terms
    from sympy import isprime
    from itertools import product
    def ok(pal):
        return isprime(pal) and isprime(sum(int(d)**2 for d in str(pal)))
    def agentod(maxdigs):
        yield 11
        for d in range(3, maxdigs+1, 2):
            pal = 10**(d-1) + 1
            if ok(pal): yield pal
            for first in "1379":
                for left in product("0123456789", repeat=(d-3)//2):
                    left = "".join(left)
                    for mid in "13579":
                        pal = int(first + left + mid + left[::-1] + first)
                        if ok(pal): yield pal
    print([an for an in agentod(5)]) # Michael S. Branicky, Nov 23 2021

A091362 Primes p such that the sum of the digits of p is not prime, but the sum of the squares of the digits of p is prime.

Original entry on oeis.org

997, 1699, 2887, 5569, 5659, 5839, 5857, 6199, 6883, 6991, 7477, 8287, 8539, 8863, 8999, 9619, 9907, 11779, 11887, 13399, 13669, 14479, 14767, 14947, 15559, 16369, 16477, 16693, 16747, 16963, 17377, 17449, 17467, 17737, 17791, 17827, 17881
Offset: 1

Views

Author

Chuck Seggelin, Jan 03 2004

Keywords

Comments

Apparently if the squares of the digits of a prime sum to a prime, it is more likely that the digits themselves also sum to a prime. In the first 10,000 primes there are 1558 primes p such that the squares of the digits of p sum to a prime. Of these, only 360 are such that the sums of the digits are not prime. Interestingly, all of these primes have a digit sum of 25 or 35. Essentially this sequence is the terms of A052034 (primes whose digits squared sum to a prime) that do not also appear in A046704 (primes whose digits sum to a prime).

Examples

			a(1)=997 because 9+9+7 = 25 which is not prime, but 9^2+9^2+7^2 = 211 which is prime.
		

Crossrefs

Cf. A046704 (primes whose digits sum to a prime), A052034 (primes whose digits squared sum to a prime).

Programs

  • Mathematica
    ssdQ[n_]:=Module[{idn=IntegerDigits[n]},!PrimeQ[Total[idn]]&&PrimeQ[ Total[ idn^2]]]; Select[Prime[Range[2100]],ssdQ] (* Harvey P. Dale, Jun 28 2011 *)

A225535 Numbers whose cubed digits sum to a cube, and have more than one nonzero digit.

Original entry on oeis.org

168, 186, 345, 354, 435, 453, 534, 543, 618, 681, 816, 861, 1068, 1086, 1156, 1165, 1516, 1561, 1608, 1615, 1651, 1680, 1806, 1860, 3045, 3054, 3405, 3450, 3504, 3540, 4035, 4053, 4305, 4350, 4503, 4530, 5034, 5043, 5116, 5161, 5304, 5340, 5403, 5430, 5611
Offset: 1

Views

Author

Keywords

Examples

			5^3 + 6^3 + 1^3 + 1^3 = 343, which is 7^3.
		

Crossrefs

Cf. A225534 (cubed digits sum to a prime), A197039 (square), A046459. A055012.
Cf. A165330 (cube cycle), A046197 (cubic fixed points), A000578 (cubes).
Cf. A052034 (squared digits sum to a prime), A028839, A117685.
Cf. A164882 (n such that sum of the cubes of the digits of n^3 is perfect cube). - Zak Seidov, May 21 2013

Programs

  • Mathematica
    fQ[n_] := Module[{d = IntegerDigits[n]}, Count[d, 0] + 1 < Length[d] && IntegerQ[Total[d^3]^(1/3)]]; Select[Range[5611], fQ] (* T. D. Noe, May 19 2013 *)
  • R
    y=rep(0,10000); len=0; x=0; library(gmp);
    digcubesum<-function(x) sum(as.numeric(unlist(strsplit(as.character(as.bigz(x)),split="")))^3);
    iscube<-function(x) ifelse(as.bigz(x)<2,T,all(table(as.numeric(factorize(x)))%%3==0));
    nonzerodig<-function(x) sum(strsplit(as.character(x),split="")[[1]]!="0");
    which(sapply(1:6000,function(x) nonzerodig(x)>1 & iscube(digcubesum(x))))

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
Showing 1-10 of 17 results. Next