A375754 a(n) is the difference between the next greater square of a prime and n*(n+1)/2.
4, 3, 1, 3, 15, 10, 4, 21, 13, 4, 66, 55, 43, 30, 16, 1, 33, 16, 118, 99, 79, 58, 36, 13, 61, 36, 10, 151, 123, 94, 64, 33, 1, 280, 246, 211, 175, 138, 100, 61, 21, 100, 58, 15, 379, 334, 288, 241, 193, 144, 94, 43, 303, 250, 196, 141, 85, 28, 138, 79, 19, 318, 256
Offset: 0
Examples
a(0) = A001248(1) - A000217(0) = 2^2 - 0 = 4, a(1) = A001248(1) - A000217(1) = 2^2 - 1 = 3, a(2) = A001248(1) - A000217(2) = 2^2 - 3 = 1, a(3) = A001248(2) - A000217(3) = 3^2 - 6 = 3.
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
NextPrime[Sqrt[#]]^2-#&/@Accumulate[Range[0,70]] (* Harvey P. Dale, Feb 16 2025 *)
-
PARI
a375754(n) = my(t=n*(n+1)/2, s=sqrtint(t), p=nextprime(s)); if(p^2-t < 0, p=nextprime(p+1)); p^2-t