login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A123907
a(n) = T(p(n)) - p(T(n)) = Commutator[triangular numbers, primes] at n.
1
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,3
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.
LINKS
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).
EXAMPLE
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.
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 *)
PROG
(PARI) vector(60, n, p=prime; b=binomial; b(p(n)+1, 2) - p(b(n+1, 2)) ) \\ G. C. Greubel, Aug 06 2019
(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
(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
CROSSREFS
KEYWORD
easy,sign,less
AUTHOR
Jonathan Vos Post, Oct 28 2006
EXTENSIONS
More terms from R. J. Mathar, Jan 13 2007
STATUS
approved