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 48 results. Next

A078403 Primes whose digital root (A038194) is prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 59, 61, 79, 83, 97, 101, 113, 131, 137, 149, 151, 167, 173, 191, 223, 227, 239, 241, 257, 263, 277, 281, 293, 311, 313, 317, 331, 347, 349, 353, 367, 383, 389, 401, 419, 421, 439, 443, 457, 461, 479, 491, 509, 547, 563, 569
Offset: 1

Views

Author

N. J. A. Sloane, Dec 26 2002

Keywords

Comments

Union of A061238, A061240, A061241 and 3. - Ya-Ping Lu, Jan 03 2024

Examples

			59 is a term because 5+9=14, giving (final) iterated sum 1+4=5 and 5 is prime.
		

Crossrefs

Programs

  • Mathematica
    Select[ Range[580], PrimeQ[ # ] && PrimeQ[Mod[ #, 9]] &]
    Select[Prime[Range[200]],PrimeQ[Mod[#,9]]&] (* Harvey P. Dale, Aug 20 2017 *)
  • PARI
    forprime(p=2,997,if(isprime(p%9),print1(p,",")))
    
  • Python
    from sympy import isprime, primerange; [print(p, end = ', ') for p in primerange(2, 570) if isprime(p%9)] # Ya-Ping Lu, Jan 03 2024

Formula

a(n) ~ 2n log n. - Charles R Greathouse IV, May 14 2025

Extensions

A079130 Primes such that iterated sum-of-digits (A038194) is a square.

Original entry on oeis.org

13, 19, 31, 37, 67, 73, 103, 109, 127, 139, 157, 163, 181, 193, 199, 211, 229, 271, 283, 307, 337, 373, 379, 397, 409, 433, 463, 487, 499, 523, 541, 571, 577, 607, 613, 631, 643, 661, 733, 739, 751, 757, 769, 787, 811, 823, 829, 859, 877, 883, 919, 937, 967
Offset: 1

Views

Author

Klaus Brockhaus, Dec 28 2002

Keywords

Comments

Primes which are 1 or 4 mod 9. - Charles R Greathouse IV, Sep 04 2014

Crossrefs

Programs

  • Maple
    select(isprime,map(t -> (9*t+1,9*t+4),[$1..1000]));  # Robert Israel, Sep 04 2014
  • Mathematica
    sQ[n_]:=MemberQ[{1,4,9},NestWhile[Total[IntegerDigits[#]]&,n,#>9&]]; Select[Prime[Range[300]],sQ] (* Harvey P. Dale, Dec 06 2012 *)
  • PARI
    forprime(p=2,1000,if(issquare(p%9),print1(p,",")))

Formula

a(n) ~ 3n log n. - Charles R Greathouse IV, Sep 04 2014

A079131 Primes such that iterated sum-of-digits (A038194) is odd.

Original entry on oeis.org

3, 5, 7, 19, 23, 37, 41, 43, 59, 61, 73, 79, 97, 109, 113, 127, 131, 149, 151, 163, 167, 181, 199, 223, 239, 241, 257, 271, 277, 293, 307, 311, 313, 331, 347, 349, 367, 379, 383, 397, 401, 419, 421, 433, 439, 457, 487, 491, 509, 523, 541, 547, 563, 577, 599
Offset: 1

Views

Author

Klaus Brockhaus, Dec 28 2002

Keywords

Comments

Subsequence of primes of A187318. - Michel Marcus, Jun 08 2015
Primes congruent to 1, 3, 5, 7 mod 18. - Robert Israel, Jun 08 2015

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(600) | p mod 18 in [1,3,5,7]]; // Vincenzo Librandi, Jun 07 2015
    
  • Magma
    [a: n in [0..1000] | IsPrime(a) where a is Floor(9*n/5)]; // Vincenzo Librandi, Jun 08 2015
  • Maple
    select(isprime, [3, seq(seq(i*18+j, j=[1,5,7]),i=0..100)]); # Robert Israel, Jun 08 2015
  • Mathematica
    Select[Prime[Range[120]], OddQ[Mod[#, 9]] &] (* Bruno Berselli, Aug 31 2012 *)
  • PARI
    forprime(p=2,600,if((p%9)%2==1,print1(p,",")))
    

A079132 Primes such that iterated sum-of-digits (A038194) is even.

Original entry on oeis.org

2, 11, 13, 17, 29, 31, 47, 53, 67, 71, 83, 89, 101, 103, 107, 137, 139, 157, 173, 179, 191, 193, 197, 211, 227, 229, 233, 251, 263, 269, 281, 283, 317, 337, 353, 359, 373, 389, 409, 431, 443, 449, 461, 463, 467, 479, 499, 503, 521, 557, 569, 571, 587, 593, 607
Offset: 1

Views

Author

Klaus Brockhaus, Dec 28 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[120]], EvenQ[Mod[#, 9]] &] (* Bruno Berselli, Aug 31 2012 *)
  • PARI
    forprime(p=2,600,if((p%9)%2==0,print1(p,",")))

A079155 The number of primes less than 10^n whose digital root (A038194) is also prime.

Original entry on oeis.org

4, 15, 85, 619, 4800, 39266, 332276, 2880818, 25423985, 227527467
Offset: 1

Views

Author

Robert G. Wilson v, Dec 27 2002

Keywords

Examples

			a(2) = 15 because the only primes less than 100 whose have digital roots are also prime are {2,3,5,7,11,23,29,41,43,47,59,61,79,83,97}.
		

Crossrefs

The primes are in A078403, their digital roots are in A078400.

Programs

  • Mathematica
    c = 0; k = 1; Do[ While[ k < 10^n, If[ PrimeQ[k] && PrimeQ[ Mod[k, 9]], c++ ]; k++ ]; Print[c], {n, 1, 8}]
  • Python
    # use primerange (slower) vs. sieve.primerange (>> memory) for larger terms
    from sympy import isprime, sieve
    def afind(terms):
      s = 0
      for n in range(1, terms+1):
        s += sum(isprime(p%9) for p in sieve.primerange(10**(n-1), 10**n))
        print(s, end=", ")
    afind(7) # Michael S. Branicky, Apr 15 2021

Extensions

a(9)-a(10) from Michael S. Branicky, Apr 15 2021

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)).

A007652 Final digit of prime(n).

Original entry on oeis.org

2, 3, 5, 7, 1, 3, 7, 9, 3, 9, 1, 7, 1, 3, 7, 3, 9, 1, 7, 1, 3, 9, 3, 9, 7, 1, 3, 7, 9, 3, 7, 1, 7, 9, 9, 1, 7, 3, 7, 3, 9, 1, 1, 3, 7, 9, 1, 3, 7, 9, 3, 9, 1, 1, 7, 3, 9, 1, 7, 1, 3, 3, 7, 1, 3, 7, 1, 7, 7, 9, 3, 9, 7, 3, 9, 3, 9, 7, 1, 9, 9, 1, 1, 3, 9, 3, 9, 7, 1, 3, 7, 9, 7, 1, 9, 3, 9, 1, 3, 1, 7, 7, 3, 9, 1
Offset: 1

Views

Author

Keywords

Comments

Primes modulo 10.

References

  • Milton Abramowitz and Irene A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 870.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

Formula

a(n) = A010879(A000040(n)). - Michel Marcus, May 06 2014
Sum_k={1..n} a(k) ~ 5*n. - Amiram Eldar, Dec 11 2024

Extensions

Extended by Ray Chandler, Oct 01 2005

A039701 a(n) = n-th prime modulo 3.

Original entry on oeis.org

2, 0, 2, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1
Offset: 1

Views

Author

Keywords

Comments

If n > 2 and prime(n) is a Mersenne prime then a(n) = 1. Proof: prime(n) = 2^p - 1 for some odd prime p, so prime(n) = 2*4^((p-1)/2) - 1 == 2 - 1 = 1 (mod 3). - Santi Spadaro, May 03 2002; corrected and simplified by Dean Hickerson, Apr 20 2003
Except for n = 2, a(n) is the smallest number k > 0 such that 3 divides prime(n)^k - 1. - T. D. Noe, Apr 17 2003
a(n) <> 0 for n <> 2; a(A049084(A003627(n))) = 2; a(A049084(A002476(n))) = 1; A134323(n) = (1 - 0^a(n)) * (-1)^(a(n)+1). - Reinhard Zumkeller, Oct 21 2007
Probability of finding 1 (or 2) in this sequence is 1/2. This follows from the Prime Number Theorem in arithmetic progressions. Examples: There are 4995 1's in terms (10^9 +1) to (10^9+10^4); there are 10^9/2-1926 1's in the first 10^9 terms. - Jerzy R Borysowicz, Mar 06 2022

Crossrefs

Cf. A091178 (indices of 1's), A091177 (indices of 2's).
Cf. A120326 (partial sums).
Cf. A010872.

Programs

Formula

Sum_k={1..n} a(k) ~ (3/2)*n. - Amiram Eldar, Dec 11 2024

A039702 a(n) = n-th prime modulo 4.

Original entry on oeis.org

2, 3, 1, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 1, 1, 3, 3, 1, 1, 3, 3, 1, 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, 1, 1, 3, 3, 3, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, 1, 3, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 1, 3, 1, 3, 1, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3
Offset: 1

Views

Author

Keywords

Comments

Except for the first term, A100672(n) = (a(n)-1)/2 = parity of A005097. - Jeremy Gardiner, May 17 2008

Crossrefs

Programs

Formula

Sum_k={1..n} a(k) ~ 2*n. - Amiram Eldar, Dec 11 2024

A039706 a(n) = n-th prime modulo 8.

Original entry on oeis.org

2, 3, 5, 7, 3, 5, 1, 3, 7, 5, 7, 5, 1, 3, 7, 5, 3, 5, 3, 7, 1, 7, 3, 1, 1, 5, 7, 3, 5, 1, 7, 3, 1, 3, 5, 7, 5, 3, 7, 5, 3, 5, 7, 1, 5, 7, 3, 7, 3, 5, 1, 7, 1, 3, 1, 7, 5, 7, 5, 1, 3, 5, 3, 7, 1, 5, 3, 1, 3, 5, 1, 7, 7, 5, 3, 7, 5, 5, 1, 1, 3, 5, 7, 1, 7, 3, 1, 1, 5, 7, 3, 7, 7, 3, 3, 7, 5, 1, 3, 5, 3, 5, 3, 1, 3
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

Formula

Sum_k={1..n} a(k) ~ 4*n. - Amiram Eldar, Dec 11 2024
Showing 1-10 of 48 results. Next