A384195 a(n) = tau(n+1) - tau(n-1), where tau(n) = A000005(n), the number of divisors of n.
1, 1, 0, 1, 0, 0, 1, 0, -1, 2, 0, -2, 2, 1, -2, 1, 0, 0, 2, -2, -2, 4, 1, -4, 1, 2, -2, 2, 0, -2, 2, -2, 0, 5, -2, -5, 2, 4, -2, 0, 0, -2, 4, -2, -4, 6, 1, -4, 1, 0, -2, 2, 2, 0, 0, -4, -2, 8, 0, -8, 4, 3, -2, 1, -2, -2, 2, 2, -2, 4, 0, -8, 4, 2, -2, 2, -2, 2, 3, -6, -3, 8, 2, -8
Offset: 2
Keywords
Examples
a(10) = tau(11) - tau(9) = 2 - 3 = -1.
Programs
-
Haskell
divides ∷ (Integral a) ⇒ a → a → Bool divides a b = b `mod` a == 0 properFactors ∷ Integral a ⇒ a → [a] properFactors n = 1 : filter (`divides` n) [2..(n `div` 2)] factors ∷ Integral a ⇒ a → [a] factors 1 = [1] factors n = properFactors n <> [n] tauSuccMinusTauPred :: Integer -> Integer tauSuccMinusTauPred n = fromIntegral (length (factors (n + 1))) - fromIntegral (length (factors (n - 1)))
-
PARI
a(n) = numdiv(n+1) - numdiv(n-1); \\ Michel Marcus, May 21 2025
Formula
a(n) = tau(n+1) - tau(n-1).
Comments