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

A034953 Triangular numbers (A000217) with prime indices.

Original entry on oeis.org

3, 6, 15, 28, 66, 91, 153, 190, 276, 435, 496, 703, 861, 946, 1128, 1431, 1770, 1891, 2278, 2556, 2701, 3160, 3486, 4005, 4753, 5151, 5356, 5778, 5995, 6441, 8128, 8646, 9453, 9730, 11175, 11476, 12403, 13366, 14028, 15051, 16110, 16471, 18336, 18721, 19503
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

The following sequences (allowing offset of first term) all appear to have the same parity: A034953, triangular numbers with prime indices; A054269, length of period of continued fraction for sqrt(p), p prime; A082749, difference between the sum of next prime(n) natural numbers and the sum of next n primes; A006254, numbers n such that 2n-1 is prime; A067076, 2n+3 is a prime. - Jeremy Gardiner, Sep 10 2004
Given a rectangular prism with sides 1, p, p^2 for p = n-th prime (n > 1), the area of the six sides divided by the volume gives a remainder which is 4*a(n). - J. M. Bergot, Sep 12 2011
The infinite sum over the reciprocals is given by 2*A179119. - Wolfdieter Lang, Jul 10 2019

Crossrefs

Programs

  • Haskell
    a034953 n = a034953_list !! (n-1)
    a034953_list = map a000217 a000040_list
    -- Reinhard Zumkeller, Sep 23 2011
  • Maple
    a:= n-> (p-> p*(p+1)/2)(ithprime(n)):
    seq(a(n), n=1..65);  # Alois P. Heinz, Apr 20 2022
  • Mathematica
    t[n_] := n(n + 1)/2; Table[t[Prime[n]], {n, 44}] (* Robert G. Wilson v, Aug 12 2004 *)
    (#(# + 1))/2&/@Prime[Range[50]] (* Harvey P. Dale, Feb 27 2012 *)
    With[{nn=200},Pick[Accumulate[Range[nn]],Table[If[PrimeQ[n],1,0],{n,nn}],1]] (* Harvey P. Dale, Mar 05 2023 *)
  • PARI
    forprime(p=2,1e3,print1(binomial(p+1,2)", ")) \\ Charles R Greathouse IV, Jul 19 2011
    
  • PARI
    apply(n->binomial(n+1,2),primes(100)) \\ Charles R Greathouse IV, Jun 04 2013
    

Formula

a(n) = A000217(A000040(n)). - Omar E. Pol, Jul 27 2009
a(n) = Sum_{k=1..prime(n)} k. - Wesley Ivan Hurt, Apr 27 2021
Product_{n>=1} (1 - 1/a(n)) = A307868. - Amiram Eldar, Nov 07 2022

A007468 Sum of next n primes.

Original entry on oeis.org

2, 8, 31, 88, 199, 384, 659, 1056, 1601, 2310, 3185, 4364, 5693, 7360, 9287, 11494, 14189, 17258, 20517, 24526, 28967, 33736, 38917, 45230, 51797, 59180, 66831, 75582, 84463, 95290, 106255, 117424, 129945, 143334, 158167, 173828, 190013, 207936, 225707, 245724
Offset: 1

Views

Author

Keywords

Comments

If we arrange the prime numbers into a triangle, with 2 at the top, 3 and 5 in the second row, 7, 11 and 13 in the third row, and so on and so forth, this sequence gives the row sums. - Alonso del Arte, Nov 08 2011
In the first 20000 terms, the only perfect square > 1 is 207936 (n=38). Is it the only one? Is there some proof/conjecture? - Carlos Eduardo Olivieri, Mar 09 2015

Examples

			a(1)=2 because "sum of next 1 prime" is 2;
a(2)=8 because sum of next 2 primes is 3+5=8;
a(3)=31 because sum of next 3 primes is 7+11+13=31, etc.
		

References

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

Crossrefs

Cf. A078721 and A011756 for the starting and ending prime of each sum.

Programs

  • Mathematica
    a[n_] := Sum[Prime[i], {i, 1+n(n-1)/2, n+n(n-1)/2}]; Table[a[n], {n,100}]
    (* Second program: *)
    With[{nn=40},Total/@TakeList[Prime[Range[(nn(nn+1))/2]],Range[nn]]] (* Requires Mathematica version 11 or later *) (* Harvey P. Dale, Jan 15 2020 *)
  • Python
    from sympy import nextprime
    def aupton(terms):
      alst, p = [], 2
      for n in range(1, terms+1):
        s = 0
        for i in range(n):
          s += p
          p = nextprime(p)
        alst.append(s)
      return alst
    print(aupton(40)) # Michael S. Branicky, Feb 08 2021

Formula

a(n) = prime(1 + n(n-1)/2) + ... + prime(n + n(n-1)/2), where prime(i) is i-th prime.

Extensions

More terms from Zak Seidov, Sep 21 2002

A078721 a(n) = prime(n*(n+1)/2 + 1).

Original entry on oeis.org

2, 3, 7, 17, 31, 53, 79, 109, 157, 199, 263, 331, 401, 479, 577, 661, 773, 887, 1021, 1153, 1297, 1459, 1609, 1787, 1993, 2161, 2377, 2609, 2797, 3041, 3313, 3547, 3803, 4079, 4363, 4663, 4987, 5309, 5647, 5953, 6311, 6689, 7027, 7481, 7841, 8263, 8689
Offset: 0

Views

Author

Cino Hilliard, Dec 20 2002

Keywords

Comments

Primes on the left side of the triangle formed by listing successively the prime numbers in a triangular grid:
2
3 5
7 11 13
17 19 23 29
31 37 41 43 47
53 59 61 67 71 73
The sum of the reciprocals appears to converge.
As the terms grow faster than the triangular numbers and the sum of inverse numbers converges, the sum of inverses indeed converges. - Joerg Arndt, Oct 28 2015
When arranged as a rectangular array, every row eventually intersperses every other row and every column eventually intersperses every other column; see example. - Clark Kimberling, Apr 13 2025

Examples

			    2     3     7    17    31    53    79   109   157   199
    5    11    19    37    59    83   113   163   211   269
   13    23    41    61    89   127   167   223   271   347
   29    43    67    97   131   173   227   277   349   421
   47    71   101   137   179   229   281   353   431   503
   73   103   139   181   233   283   359   433   509   607
  107   149   191   239   293   367   439   521   613   709
  151   193   241   307   373   443   523   617   719   827
  197   251   311   379   449   541   619   727   829   953
  257   313   383   457   547   631   733   839   967  1087
Interspersion of rows 3 and 5 begins with
  41  61  89  127...
    43  67  97...
Interspersion of columns 3 and 5 begins with
  19
    31
  41
    59
  67
    89
		

Crossrefs

Programs

  • Magma
    [NthPrime(n*(n + 1) div 2+1): n in [0..50]]; // Vincenzo Librandi, Jun 08 2016
  • Mathematica
    Table[Prime[n (n + 1)/2 + 1], {n, 0, 46}] (* Michael De Vlieger, Oct 28 2015 *)
    Prime[#]&/@(Accumulate[Range[0,50]]+1) (* Harvey P. Dale, Aug 04 2018 *)
    Grid[Table[Prime[n + (n + k - 2) (n + k - 1)/2], {n, 1, 20}, {k, 1, 15}]]
    (* Clark Kimberling, Apr 13 2025 *)
  • PARI
    a(n) = prime(n*(n+1)/2 + 1);
    

Formula

a(n) = A000040(A000124(n)). - Altug Alkan, Oct 28 2015
a(n) = A151800(A011756(n)) for n >= 1. - Amiram Eldar, Sep 05 2024

A217916 a(n) = prime(n) - Sum_{k=1..A002024(n)-1} a(n-k), where A002024(m) = [sqrt(2*m)+1/2] is "n appears n times".

Original entry on oeis.org

2, 1, 4, 2, 5, 6, 4, 4, 9, 12, 2, 10, 8, 11, 16, 6, 8, 12, 14, 15, 18, 6, 10, 14, 20, 18, 17, 22, 2, 10, 24, 18, 26, 20, 27, 24, 6, 8, 14, 30, 24, 28, 30, 29, 28, 2, 18, 20, 18, 32, 28, 34, 32, 39, 34, 6, 8, 20, 26, 22, 34, 38, 48, 36, 41, 38, 14, 12, 18, 22, 30
Offset: 1

Views

Author

Paul D. Hanna, Mar 04 2013

Keywords

Comments

Form this sequence into a number triangle, then it seems that:
(1) the odd numbers only appear adjacent to the main diagonal;
(2) the number 2 only appears in column 1.

Examples

			Start with a(1) = 2, from then on, the sum of A002024(n) consecutive terms prior to and including a(n) generates the n-th prime number
(A002024 begins: [1, 2,2, 3,3,3, 4,4,4,4, 5,5,5,5,5, ...]).
n=1: 2 = 2; (start)
n=2: 3 = 2 + 1; (sum of 2 terms = prime)
n=3: 5 = 1 + 4;     "
n=4: 7 = 1 + 4 + 2; (sum of 3 terms = prime)
n=5: 11 = 4 + 2 + 5;    "
n=6: 13 = 2 + 5 + 6;    "
n=7: 17 = 2 + 5 + 6 + 4; (sum of 4 terms = prime)
n=8: 19 = 5 + 6 + 4 + 4;    "
n=9: 23 = 6 + 4 + 4 + 9;    "
n=10: 29 = 4 + 4 + 9 + 12;    "
n=11: 31 = 4 + 4 + 9 + 12 + 2; (sum of 5 terms = prime)
...
As a triangle, the sequence begins:
2;
1, 4;
2, 5, 6;
4, 4, 9, 12;
2, 10, 8, 11, 16;
6, 8, 12, 14, 15, 18;
6, 10, 14, 20, 18, 17, 22;
2, 10, 24, 18, 26, 20, 27, 24;
6, 8, 14, 30, 24, 28, 30, 29, 28;
2, 18, 20, 18, 32, 28, 34, 32, 39, 34;
6, 8, 20, 26, 22, 34, 38, 48, 36, 41, 38;
14, 12, 18, 22, 30, 28, 42, 44, 54, 40, 47, 46;
4, 22, 22, 20, 32, 32, 34, 46, 50, 62, 44, 49, 50;
12, 12, 26, 30, 24, 38, 44, 36, 64, 56, 72, 50, 55, 52;
6, 22, 18, 32, 32, 30, 44, 48, 38, 76, 66, 74, 54, 61, 58;
2, 18, 26, 24, 40, 42, 38, 54, 56, 44, 82, 70, 82, 60, 65, 66;
4, 16, 28, 38, 26, 50, 44, 42, 56, 66, 58, 86, 72, 86, 74, 69, 68;
4, 24, 20, 36, 48, 34, 54, 50, 48, 70, 70, 64, 92, 80, 92, 86, 73, 74;
2, 14, 26, 26, 46, 50, 44, 56, 56, 66, 74, 72, 68, 98, 86, 100, 92, 79, 96;
2, 12, 22, 36, 32, 52, 58, 56, 60, 62, 72, 76, 78, 80, 108, 104, 102, 96, 85, 98; ...
Notice the positions of the odd numbers and of the number 2;
the only odd numbers appear adjacent to the main diagonal and
the number 2 only appears in the first column.
		

Crossrefs

Cf. A011756, A217917 (odd numbers that appear), A217918 (positions of 2), A217919 (rows in which 2 appears), A217920 (column 1).

Programs

  • PARI
    /* Using the recurrence (slow) */
    {a(n)=if(n<1,0,if(n==1,2,prime(n)-sum(k=1,floor(1/2+sqrt(2*n))-1,a(n-k))))}
    for(n=1,120,print1(a(n),", "))
    
  • PARI
    /* Print as a Triangle of M Rows (much faster) */
    {M=20;A=vector(M*(M+1)/2);}
    {a(n)=A[n]=if(n<1,0,if(n==1,2,prime(n)-sum(k=1,floor(1/2+sqrt(2*n))-1,A[n-k])))}
    for(n=1,M,for(k=1,n,print1(a(n*(n-1)/2+k),", "));print(""))

Formula

Row sums equal A011756(n) = prime(n(n+1)/2).

A304037 If n = Product (p_j^k_j) then a(n) = Sum (pi(p_j)^k_j), where pi() = A000720.

Original entry on oeis.org

0, 1, 2, 1, 3, 3, 4, 1, 4, 4, 5, 3, 6, 5, 5, 1, 7, 5, 8, 4, 6, 6, 9, 3, 9, 7, 8, 5, 10, 6, 11, 1, 7, 8, 7, 5, 12, 9, 8, 4, 13, 7, 14, 6, 7, 10, 15, 3, 16, 10, 9, 7, 16, 9, 8, 5, 10, 11, 17, 6, 18, 12, 8, 1, 9, 8, 19, 8, 11, 8, 20, 5, 21, 13, 11, 9, 9, 9, 22, 4, 16, 14, 23, 7, 10, 15, 12, 6
Offset: 1

Views

Author

Ilya Gutkovskiy, May 05 2018

Keywords

Examples

			a(72) = 5 because 72 = 2^3*3^2 = prime(1)^3*prime(2)^2 and 1^3 + 2^2 = 5.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Plus @@ (PrimePi[#[[1]]]^#[[2]]& /@ FactorInteger[n]); a[1] = 0; Table[a[n], {n, 1, 88}]

Formula

If gcd(u,v) = 1 then a(u*v) = a(u) + a(v).
a(p^k) = A000720(p)^k where p is a prime.
a(A002110(m)^k) = 1^k + 2^k + ... + m^k.
As an example:
a(A000040(k)) = k.
a(A006450(k)) = A000040(k).
a(A038580(k)) = A006450(k).
a(A001248(k)) = a(A011757(k)) = A000290(k).
a(A030078(k)) = a(A055875(k)) = A000578(k).
a(A002110(k)) = a(A011756(k)) = A000217(k).
a(A061742(k)) = A000330(k).
a(A115964(k)) = A000537(k).
a(A080696(k)) = A007504(k).
a(A076954(k)) = A001923(k).

A123907 a(n) = T(p(n)) - p(T(n)) = Commutator[triangular numbers, primes] at n.

Original entry on oeis.org

1, 1, 2, -1, 19, 18, 46, 39, 79, 178, 179, 306, 394, 375, 469, 662, 887, 872, 1127, 1265, 1248, 1553, 1703, 2018, 2600, 2780, 2763, 2987, 2958, 3134, 4587, 4849, 5380, 5373, 6518, 6503, 7100, 7725, 8089, 8750, 9431, 9452, 10859, 10892, 11260, 11219, 13275, 15485, 15947, 15908, 16358, 17257, 17222, 19189
Offset: 1

Views

Author

Jonathan Vos Post, Oct 28 2006

Keywords

Comments

Asymptotically p(T(n)) ~ (n^2 + n)*(log n) and T(p(n)) ~ (1/2)(n log n)^2, hence asymptotically a(n) ~ (1/2)(n log n)^2 - (n^2 + n)*(log n) = O((n^2)(log n)^2). a(4) = -1 should be the only negative value.

Examples

			a(1) = T(p(1)) - p(T(1)) = T(2) - p(1) = 3 - 2 = 1.
a(2) = T(p(2)) - p(T(2)) = T(2) - p(1) = 6 - 5 = 1.
a(3) = T(p(3)) - p(T(3)) = T(2) - p(1) = 15 - 13 = 1.
a(4) = T(p(4)) - p(T(4)) = T(2) - p(1) = 28 - 29 = -1.
a(5) = T(p(5)) - p(T(5)) = T(2) - p(1) = 66 - 47 = 19.
		

Crossrefs

Programs

  • Magma
    P:=NthPrime; B:=Binomial; [B(P(n)+1,2) - P(B(n+1,2)): n in [1..60]]; // G. C. Greubel, Aug 06 2019
    
  • Maple
    A000040 := proc(n) ithprime(n) ; end; A000217 := proc(n) n*(n+1)/2 ; end; A123907 := proc(n) A000217(A000040(n))-A000040(A000217(n)) ; end ; for n from 1 to 80 do printf("%d,",A123907(n)) ; end; # R. J. Mathar, Jan 13 2007
  • Mathematica
    With[{B=Binomial, P=Prime}, Table[B[P[n]+1, 2] -P[B[n+1, 2]], {n, 60}]] (* G. C. Greubel, Aug 06 2019 *)
  • PARI
    vector(60, n, p=prime; b=binomial; b(p(n)+1,2) - p(b(n+1,2)) ) \\ G. C. Greubel, Aug 06 2019
    
  • Sage
    p=nth_prime; b=binomial; [b(p(n)+1,2) - p(b(n+1,2)) for n in (1..60)] # G. C. Greubel, Aug 06 2019

Formula

a(n) = T(p(n)) - p(T(n)) where T(i) = i*(i+1)/2, p(i) = prime(i).
a(n) = A000217(A000040(n)) - A000040(A000217(n)).
a(n) = p(n)*(p(n)+1)/2 - p(n*(n+1)/2) where p(i) = prime(i).
a(n) = A034953(n) - A011756(n).

Extensions

More terms from R. J. Mathar, Jan 13 2007

A125312 Moessner triangle based on primes.

Original entry on oeis.org

2, 3, 5, 10, 21, 13, 48, 105, 80, 29, 264, 628, 553, 232, 47, 1730, 4378, 4235, 2059, 543, 73, 13024, 34620, 36078, 19553, 6063, 1095, 107, 110542, 306362, 339554, 200769, 70350, 15166, 2000, 151, 1044900, 3003012, 3507070, 2228398, 861305, 212514
Offset: 1

Views

Author

Gary W. Adamson, Dec 10 2006

Keywords

Comments

Row sums are 2, 8, 44, 262, 1724, 13024, ... Conjecture: log row n-th sum tends to (2n-3) + some unknown fractional part. E.g., log 1724 = 7.45... while log 13024 = 9.43... Right border = A011756.

Examples

			First few rows of the triangle are:
     2;
     3,    5;
    10,   21,   13;
    48,  105,   80,   29;
   164,  628,  553,  232,  47;
  1736, 4378, 4235, 2059, 543, 73;
  ...
		

References

  • J. H. Conway and R. K. Guy, "The Book of Numbers", Springer-Verlag, 1996, p. 64.

Crossrefs

Formula

Begin with the primes and circle every (n*(n+1)/2)-th prime: 1, 5, 13, 29, 47, ... = A011756. Following the instructions in A125714, take partial sums of the uncircled terms, making this row 2. Circle the terms in row 2 one place to the left of row 1 terms. Take partial sums of the uncircled terms, continuing with analogous procedures for subsequent rows.

Extensions

Corrected and extended by Joshua Zucker, Jun 17 2007

A344482 Primes, each occurring twice, such that a(C(n)) = a(4*n-C(n)) = prime(n), where C is the Connell sequence (A001614).

Original entry on oeis.org

2, 3, 2, 5, 7, 3, 11, 5, 13, 17, 7, 19, 11, 23, 13, 29, 31, 17, 37, 19, 41, 23, 43, 29, 47, 53, 31, 59, 37, 61, 41, 67, 43, 71, 47, 73, 79, 53, 83, 59, 89, 61, 97, 67, 101, 71, 103, 73, 107, 109, 79, 113, 83, 127, 89, 131, 97, 137, 101, 139, 103, 149, 107, 151
Offset: 1

Views

Author

Paolo Xausa, Aug 16 2021

Keywords

Comments

Terms can be arranged in an irregular triangle read by rows in which row r is a permutation P of the primes in the interval [prime(s), prime(s+rlen-1)], where s = 1+(r-1)*(r-2)/2, rlen = 2*r-1 = A005408(r-1) and r >= 1 (see example).
P is the alternating (first term > second term < third term > fourth term < ...) permutation m -> 1, 1 -> 2, m+1 -> 3, 2 -> 4, m+2 -> 5, 3 -> 6, ..., rlen -> rlen where m = ceiling(rlen/2).
The triangle has the following properties.
Row lengths are the positive odd numbers (A005408).
First column is A078721.
Column 3 is A078722 (for n >= 1).
Column 5 is A078724 (for n >= 2).
Column 7 is A078725 (for n >= 3).
Each even column is equal to the column preceding it.
Row records (A011756) are in the right border.
Indices of row records are the positive terms of A000290.
Each row r contains r terms that are duplicated in the next row.
In each row, the sum of terms which are not already listed in the sequence give A007468.
For rows r >= 2, row sum is A007468(r)+A007468(r-1) and row product is A007467(r)*A007467(r-1).

Examples

			Written as an irregular triangle the sequence begins:
   2;
   3,   2,   5;
   7,   3,  11,   5,  13;
  17,   7,  19,  11,  23,  13,  29;
  31,  17,  37,  19,  41,  23,  43,  29,  47;
  53,  31,  59,  37,  61,  41,  67,  43,  71,  47,  73;
  79,  53,  83,  59,  89,  61,  97,  67, 101,  71, 103,  73, 107;
  ...
The triangle can be arranged as shown below so that, in every row, each odd position term is equal to the term immediately below it.
                2
             3  2  5
          7  3 11  5 13
      17  7 19 11 23 13 29
   31 17 37 19 41 23 43 29 47
              ...
		

Crossrefs

Programs

  • Mathematica
    nterms=64;a=ConstantArray[0,nterms];For[n=1;p=1,n<=nterms,n++,If[a[[n]]==0,a[[n]]=Prime[p];If[(d=4p-n)<=nterms,a[[d]]=a[[n]]];p++]]; a
    (* Second program, triangle rows *)
    nrows=8;Table[rlen=2r-1;Permute[Prime[Range[s=1+(r-1)(r-2)/2,s+rlen-1]],Join[Range[2,rlen,2],Range[1,rlen,2]]],{r,nrows}]

Formula

a(A001614(n)) = a(4*n-A001614(n)) = prime(n).

A254955 Prime numbers indexed by oblong numbers.

Original entry on oeis.org

3, 13, 37, 71, 113, 181, 263, 359, 463, 601, 743, 911, 1091, 1291, 1511, 1747, 2017, 2297, 2617, 2903, 3271, 3617, 4003, 4409, 4831, 5297, 5743, 6247, 6761, 7297, 7853, 8443, 9029, 9631, 10271, 10973, 11717, 12413, 13109, 13879, 14717, 15461, 16301, 17191, 18059
Offset: 1

Views

Author

Waldemar Puszkarz, Feb 11 2015

Keywords

Examples

			a(1) = prime(1 + 1^2) = prime(2) = 3.
a(2) = prime(2 + 2^2) = prime(6) = 13.
		

Crossrefs

Cf. A000040, A002378 (n*(n+1)), A011756 (prime(n(n+1)/2)), A011757 (prime(n^2)).

Programs

  • Magma
    [NthPrime(n+n^2): n in [1..50]]; // Vincenzo Librandi, Feb 24 2015
  • Mathematica
    Table[Prime[n + n^2], {n, 100}] (* Puszkarz *)
    Prime[2Accumulate[Range[40]]] (* Alonso del Arte, Feb 11 2015 *)
  • PARI
    vector(80, n, prime(n+n^2)) \\ Michel Marcus, Feb 12 2015
    

Formula

a(n) = prime(n + n^2) = A000040(A002378(n)).
Showing 1-9 of 9 results.