%I #30 Oct 25 2023 06:16:28
%S 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,
%T 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,
%U 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
%N a(n) = number of numbers d with n mod d <= 1.
%H Reinhard Zumkeller, <a href="/A092338/b092338.txt">Table of n, a(n) for n = 1..10000</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Iverson_bracket">Iverson bracket</a>
%F 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
%F For n>1, a(n) = Sum_{i=1..n-1} floor(n/i)-floor((n-2)/i). - _Wesley Ivan Hurt_, Sep 13 2017
%F a(n) = A000005(n) + [n>1]*(A000005(n-1) - 1). - _Ridouane Oudra_, Oct 07 2019
%p with(numtheory): seq(tau(n)+`if`(n>1, tau(n-1)-1, 0), n=1..80); # _Ridouane Oudra_, Oct 07 2019
%o (Haskell)
%o a092338 n = length $ filter (<= 1) $ map (mod n) [1..n]
%o -- _Reinhard Zumkeller_, Jul 04 2012
%o (PARI) A006218(n)=sum(k=1, sqrtint(n), n\k)*2-sqrtint(n)^2
%o a(n)=if(n>4, A006218(n)-A006218(n-2)-1, n) \\ _Charles R Greathouse IV_, Sep 13 2017
%o (Magma) [#[d:d in [1..n]| n mod d le 1]:n in [1..100]]; // _Marius A. Burtea_, Oct 07 2019
%o (Python)
%o from sympy import divisor_count
%o def A092338(n): return divisor_count(n)+divisor_count(n-1)-1 if n>1 else 1 # _Chai Wah Wu_, Oct 24 2023
%Y Cf. A000005.
%K nonn,easy
%O 1,2
%A _Reinhard Zumkeller_, Mar 18 2004
%E Wrong comment removed by _Reinhard Zumkeller_, Jul 04 2012
|