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.

A298008 a(n) = f(n-1,n) + 10*(n-1), where f(a,b) is the number of primes in the range [10*a,10*b].

Original entry on oeis.org

4, 14, 22, 32, 43, 52, 62, 73, 82, 91, 104, 111, 121, 133, 141, 152, 162, 172, 181, 194, 200, 211, 223, 232, 241, 252, 262, 272, 282, 291, 301, 313, 320, 332, 342, 352, 361, 372, 382, 391, 402, 411, 421, 433, 442, 451, 463, 471, 481, 492, 502, 510, 522, 530, 542, 551, 562, 572, 581, 592, 602, 613, 620, 631, 643
Offset: 1

Views

Author

Luis F.B.A. Alexandre, Jan 10 2018

Keywords

Examples

			The first term has the number of prime numbers between 0 and 9: 4. Since the numbers in this first range are smaller than 10, the left digit would be a zero (not represented). The second term has the number of prime numbers between 10 and 19 (4) and since it was counted in the range between 10 and 19 it represents this range with the one in the first digit in the left: 14. The third element is 22 as there are 2 primes between 20 and 29. And so on. Larger element: there is only one prime between 120 and 129, hence a(13)=121.
		

Crossrefs

Cf. A038800.

Programs

  • Mathematica
    Block[{p = 1, k}, k = 10^p; Array[Apply[Subtract, PrimePi[{k #, k (# - 1)}]] + (# - 1) k &, 67]] (* Michael De Vlieger, Jan 11 2018 *)
  • Python
    # Generates all elements of the sequence smaller than 'last'
    last = 1000
    p=[2]
    c=1
    for i in range(3,last+2,2):
        prime = True
        for j in p:
            if i%j == 0:
                prime=False;
                break;
        if prime:
            p.append(i)
            c = c + 1
        ii = (i//10)*10
        if i-ii == 1:
            if prime:
                print(ii-10+c-1, end=',')
                c = 1
            else:
                print(ii-10+c, end=',')
                c = 0

Formula

a(n) = A038800(n-1) + 10*(n-1). - Michel Marcus, Jan 11 2018

Extensions

Edited by N. J. A. Sloane, Jan 28 2018