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.

A138383 If prime(i) = i-th prime, a(n) = prime(n)+1 + prime(n)+2 + ... + prime(n+1). a(0) = 3 by convention.

This page as a plain text file.
%I A138383 #25 Jun 01 2024 20:07:47
%S A138383 3,3,9,13,38,25,62,37,86,159,61,207,158,85,182,303,339,121,387,278,
%T A138383 145,459,326,519,748,398,205,422,217,446,1687,518,807,277,1445,301,
%U A138383 927,963,662,1023,1059,361,1865,385,782,397,2466,2610,902,457,926,1419,481,2465,1527
%N A138383 If prime(i) = i-th prime, a(n) = prime(n)+1 + prime(n)+2 + ... + prime(n+1). a(0) = 3 by convention.
%C A138383 First differences of A034953 for n > 0. - _Gionata Neri_, May 17 2015
%F A138383 a(n) = (prime(n+1)-prime(n))*(prime(n+1)+prime(n)+1)/2 for n >= 1. - _N. J. A. Sloane_, May 08 2008
%e A138383 3 = 1 + 2;
%e A138383 3 = 3;
%e A138383 9 = 4 + 5;
%e A138383 13 = 6 + 7;
%e A138383 38 = 8 + 9 + 10 + 11;
%e A138383 ...
%p A138383 3, seq((ithprime(n+1)-ithprime(n))*(ithprime(n+1)+ithprime(n)+1)/2, n=1..100); # _Robert Israel_, May 17 2015
%t A138383 Join[{3}, Table[(Prime[n+1] - Prime[n]) (Prime[n+1] + Prime[n] + 1)/2, {n, 60}]] (* _Vincenzo Librandi_, May 18 2015 *)
%t A138383 Join[{3},(#[[2]]-#[[1]]) (Total[#]+1)/2&/@Partition[Prime[Range[ 60]],2,1]] (* _Harvey P. Dale_, Oct 27 2020 *)
%o A138383 (Magma) [3] cat [(NthPrime(n+1) - NthPrime(n))*(NthPrime(n+1) + NthPrime(n)+1)/2: n in [1..60]]; // _Vincenzo Librandi_, May 18 2015
%o A138383 (Python)
%o A138383 from sympy import prime, nextprime
%o A138383 def A138383(n):
%o A138383     if n == 0: return 3
%o A138383     q = nextprime(p:=prime(n))
%o A138383     return (q-p)*(p+q+1)>>1 # _Chai Wah Wu_, Jun 01 2024
%Y A138383 Cf. A000040.
%K A138383 nonn,easy
%O A138383 0,1
%A A138383 _Odimar Fabeny_, May 08 2008