[go: up one dir, main page]

login
Number of ways the numbers from 1..n do not divide the numbers from n..2n-1.
1

%I #18 Oct 23 2023 17:21:20

%S 0,1,4,8,14,22,32,42,57,72,88,108,129,151,177,203,232,262,295,329,367,

%T 405,443,487,532,577,627,675,727,783,839,895,956,1018,1082,1148,1217,

%U 1285,1357,1431,1506,1586,1664,1746,1832,1914,2002,2092,2186,2277,2374,2472,2568,2672

%N Number of ways the numbers from 1..n do not divide the numbers from n..2n-1.

%F a(n) = Sum_{k=1..n} Sum_{i=n..2n-1} sign(i mod k).

%F a(n) = n*(n+1) - 1 + A006218(n-1) - A006218(2n-1). - _Chai Wah Wu_, Feb 08 2022

%e a(5) = 14; there are 14 ways that the numbers 1..5 do not divide the numbers 5..9. 2 does not divide 5,7,9 (3 ways) + 3 does not divide 5,7,8 (3 ways) + 4 does not divide 5,6,7,9 (4 ways) + 5 does not divide 6,7,8,9 (4 ways) = 14 ways.

%o (Python)

%o def A351362(n): return 1 if n == 2 else n*n-1-sum((2*n-1)//k for k in range(2,2*n-1))+sum((n-1)//k for k in range(2,n-1)) # _Chai Wah Wu_, Feb 08 2022

%o (Python)

%o from math import isqrt

%o def A351362(n): return ((t:=isqrt(m:=(n<<1)-1))+(s:=isqrt(r:=n-1)))*(t-s)+(sum(r//k for k in range(1,s+1))-sum(m//k for k in range(1,t+1))<<1)+n*(n+1)-1 # _Chai Wah Wu_, Oct 23 2023

%Y Cf. A006218, A077024, A351355.

%K nonn

%O 1,3

%A _Wesley Ivan Hurt_, Feb 08 2022