login
A092338
a(n) = number of numbers d with n mod d <= 1.
1
1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 5, 7, 7, 5, 7, 8, 6, 7, 7, 7, 9, 7, 5, 9, 10, 6, 7, 9, 7, 9, 9, 7, 9, 7, 7, 12, 10, 5, 7, 11, 9, 9, 9, 7, 11, 9, 5, 11, 12, 8, 9, 9, 7, 9, 11, 11, 11, 7, 5, 13, 13, 5, 9, 12, 10, 11, 9, 7, 9, 11, 9, 13, 13, 5, 9, 11, 9, 11, 9, 11, 14, 8, 5, 13, 15, 7, 7, 11, 9, 13
OFFSET
1,2
LINKS
Wikipedia, Iverson bracket
FORMULA
G.f.: x^2/(x - 1) + ((1 + x)*(log(1 - x) + psi(1, x)))/log(x) where psi(1,x) is the logarithmic derivative of the x-gamma function at z=1. - Olivier Gérard, Jun 24 2012
For n>1, a(n) = Sum_{i=1..n-1} floor(n/i)-floor((n-2)/i). - Wesley Ivan Hurt, Sep 13 2017
a(n) = A000005(n) + [n>1]*(A000005(n-1) - 1). - Ridouane Oudra, Oct 07 2019
MAPLE
with(numtheory): seq(tau(n)+`if`(n>1, tau(n-1)-1, 0), n=1..80); # Ridouane Oudra, Oct 07 2019
PROG
(Haskell)
a092338 n = length $ filter (<= 1) $ map (mod n) [1..n]
-- Reinhard Zumkeller, Jul 04 2012
(PARI) A006218(n)=sum(k=1, sqrtint(n), n\k)*2-sqrtint(n)^2
a(n)=if(n>4, A006218(n)-A006218(n-2)-1, n) \\ Charles R Greathouse IV, Sep 13 2017
(Magma) [#[d:d in [1..n]| n mod d le 1]:n in [1..100]]; // Marius A. Burtea, Oct 07 2019
(Python)
from sympy import divisor_count
def A092338(n): return divisor_count(n)+divisor_count(n-1)-1 if n>1 else 1 # Chai Wah Wu, Oct 24 2023
CROSSREFS
Cf. A000005.
Sequence in context: A070546 A034586 A268383 * A199769 A030601 A049839
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Mar 18 2004
EXTENSIONS
Wrong comment removed by Reinhard Zumkeller, Jul 04 2012
STATUS
approved