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-4 of 4 results.

A007605 Sum of digits of n-th prime.

Original entry on oeis.org

2, 3, 5, 7, 2, 4, 8, 10, 5, 11, 4, 10, 5, 7, 11, 8, 14, 7, 13, 8, 10, 16, 11, 17, 16, 2, 4, 8, 10, 5, 10, 5, 11, 13, 14, 7, 13, 10, 14, 11, 17, 10, 11, 13, 17, 19, 4, 7, 11, 13, 8, 14, 7, 8, 14, 11, 17, 10, 16, 11, 13, 14, 10, 5, 7, 11, 7, 13, 14, 16, 11, 17, 16, 13, 19, 14, 20, 19, 5
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a007605_list = map a007953 a000040_list -- Reinhard Zumkeller, Aug 04 2011
    
  • Magma
    [ &+Intseq(NthPrime(n), 10): n in [1..80] ]; // Klaus Brockhaus, Jun 13 2009
    
  • Maple
    map(t -> convert(convert(t,base,10),`+`), select(isprime, [2,(2*i+1 $ i=1..1000)])); # Robert Israel, Aug 16 2015
  • Mathematica
    Table[Apply[Plus, RealDigits[Prime[n]][[1]]], {n, 1, 100}]
    Plus@@ IntegerDigits[Prime[Range[100]]] (* Zak Seidov *)
  • PARI
    dsum(n)=my(s);while(n,s+=n%10;n\=10);s
    forprime(p=2,1e3,print1(dsum(p)", ")) \\ Charles R Greathouse IV, Jul 15 2011
    
  • PARI
    a(n) = sumdigits(prime(n)); \\ Michel Marcus, Dec 20 2017
    
  • Python
    from sympy import prime
    def a(n): return sum(map(int, str(prime(n))))
    print([a(n) for n in range(1, 80)]) # Michael S. Branicky, Feb 03 2021

Formula

a(n) = A007953(A000040(n)) = A007953(prime(n)).

A048519 Prime plus its digit sum equals a prime.

Original entry on oeis.org

11, 13, 19, 37, 53, 59, 71, 73, 97, 101, 103, 127, 149, 163, 167, 181, 233, 257, 271, 277, 293, 307, 367, 383, 389, 419, 431, 433, 479, 499, 509, 547, 563, 587, 617, 631, 701, 727, 743, 787, 811, 839, 857, 859, 947, 1009, 1049, 1061, 1087, 1153, 1171
Offset: 1

Views

Author

Patrick De Geest, May 15 1999

Keywords

Comments

For any prime p, p +- digitsum(p, base b) can't be prime unless the base b is even, since in an odd base, an odd number always has an odd digit sum (powers of b are congruent to b (mod 2)), so p +- digitsum(p, base b) is even for odd b. This sequence is for b = 10 (where "-" is also excluded, see comment in A243442), see A243441 for b = 2. - M. F. Hasler, Nov 06 2018
See subsequence A048523 for primes which only once give another prime under iteration of A062028, and A048524 .. A048527, A320878 .. A320880 for primes starting longer chains. See A090009 for their initial terms, starting the earliest chain of given length. - M. F. Hasler, Nov 09 2018

Examples

			a(9) = prime 97 because 97 + sum-of-digits(97) = 97 + 16 = 113 also a prime.
		

Crossrefs

Cf. A007953 (digit sum), A062028 (n + digit sum of n), A047791 (A062028(n) is prime), A048520.

Programs

  • Haskell
    a048519 n = a048519_list !! (n-1)
    a048519_list = map a000040 $ filter ((== 1) . a010051' . a065073) [1..]
    -- Reinhard Zumkeller, Sep 27 2014
    
  • Magma
    [p: p in PrimesUpTo(1200) | IsPrime(q) where q is p+&+Intseq(p)]; // Vincenzo Librandi, Jan 30 2018
  • Maple
    select(n -> isprime(n) and isprime(n + convert(convert(n,base,10),`+`)), [$1..10^4]); # Robert Israel, Aug 10 2014
  • Mathematica
    Select[Prime[Range[500]],PrimeQ[#+Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Oct 03 2011 *)
  • PARI
    select( is(p)=isprime(p+sumdigits(p))&&isprime(p), primes([0,2000])) \\ M. F. Hasler, Aug 08 2014, edited Nov 09 2018
    

Formula

Primes in A047791, i.e., intersection of A047791 and A000040. - M. F. Hasler, Nov 08 2018

A068395 a(n) = n-th prime minus its sum of digits.

Original entry on oeis.org

0, 0, 0, 0, 9, 9, 9, 9, 18, 18, 27, 27, 36, 36, 36, 45, 45, 54, 54, 63, 63, 63, 72, 72, 81, 99, 99, 99, 99, 108, 117, 126, 126, 126, 135, 144, 144, 153, 153, 162, 162, 171, 180, 180, 180, 180, 207, 216, 216, 216, 225, 225, 234, 243, 243, 252, 252, 261, 261, 270
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 08 2002

Keywords

Comments

a(i) <= a(j) for i < j.
A number and the sum of its digits have the same value modulo 9. Hence all terms are divisible by 9. - Stefan Steinerberger, Apr 01 2006
A192977 gives number of occurrences of multiples of 9. - Reinhard Zumkeller, Aug 04 2011
Margaret Coffey (ed.) p. 440: "The sum of the digits of a two-digit prime number is subtracted from the number. Prove that the difference cannot be a prime number." Proof [p.442] "Let a and b be the tens and units digits, respectively, and let 10a+b be the prime. Subtract the sum of the digits from the number: 10a + b - (a+b) = 9a. The difference is a multiple of 9 and cannot, therefore, be prime." - Jonathan Vos Post, Feb 02 2012

Examples

			a(10) = 29 - (2+9) = 18.
		

Crossrefs

Cf. A065073.

Programs

  • Haskell
    a068395 n = a068395_list !! (n-1)
    a068395_list = zipWith (-) a000040_list a007605_list
    -- Reinhard Zumkeller, Aug 04 2011
  • Mathematica
    Table[Prime[n] - Sum[DigitCount[Prime[n]][[i]]*i, {i, 1, 9}], {n, 1, 60}] (* Stefan Steinerberger, Apr 01 2006 *)
    #-Total[IntegerDigits[#]]&/@Prime[Range[60]] (* Harvey P. Dale, Oct 14 2014 *)

Formula

a(n) = A000040(n) - A007953(A000040(n)).

Extensions

More terms from Stefan Steinerberger, Apr 01 2006

A184328 Primes whose digital product is a positive square.

Original entry on oeis.org

11, 19, 41, 149, 191, 199, 229, 263, 281, 313, 331, 419, 433, 449, 491, 499, 661, 683, 797, 821, 829, 863, 881, 911, 919, 941, 977, 991, 1229, 1289, 1433, 1499, 1559, 1669, 1747, 1889, 1933, 1949, 1999, 2129, 2383, 2693, 2819, 2833, 2963, 3319, 3391, 3413
Offset: 1

Views

Author

Dario Piazzalunga, Dec 24 2012

Keywords

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(4000) | not IsZero(t) and IsSquare(t) where t is &*Intseq(p)]; // Bruno Berselli, Dec 25 2012
  • Mathematica
    fQ[n_] := Module[{d = Times @@ IntegerDigits[n]}, d > 0 && IntegerQ[Sqrt[d]]];Select[Prime[Range[1000]], fQ] (* T. D. Noe, Dec 24 2012 *)

Extensions

Corrected and extended by T. D. Noe, Dec 24 2012
Showing 1-4 of 4 results.