login
Number of integers m, 0 < m <= n, such that n divides m(m+1)/2.
2

%I #20 Sep 15 2024 02:45:57

%S 1,0,2,0,2,1,2,0,2,1,2,1,2,1,4,0,2,1,2,1,4,1,2,1,2,1,2,1,2,3,2,0,4,1,

%T 4,1,2,1,4,1,2,3,2,1,4,1,2,1,2,1,4,1,2,1,4,1,4,1,2,3,2,1,4,0,4,3,2,1,

%U 4,3,2,1,2,1,4,1,4,3,2,1,2,1,2,3,4,1,4,1,2,3,4,1,4,1,4,1,2,1,4,1,2,3,2,1,8

%N Number of integers m, 0 < m <= n, such that n divides m(m+1)/2.

%C Least n with a(n) = 2^k is prime(k+1)#/2 = A002110(A000040(k+1))/2. Least n with a(n) = 2^k-1 != 1 is p(k+1)#.

%H G. C. Greubel, <a href="/A068067/b068067.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 0 iff n = 2^k with k >= 1.

%F If n is even, a(n) = 2^(omega(n)-1) - 1; if n is odd, a(n) = 2^omega(n). Here omega(n) = A001221(n) is the number of distinct prime divisors of n.

%F A068068(n) - a(n) = 0 if n is odd, 1 if n is even.

%t a[n_] := Length[Select[Range[n], Mod[ #(#+1)/2, n]==0&]]

%o (PARI) a(n) = {my(c = 0); for(k = 1, n, c += !((k*(k+1)/2) % n)); c;} \\ _Amiram Eldar_, Sep 15 2024

%Y Cf. A000040, A001221, A002110, A068068.

%K nonn

%O 1,3

%A _Robert G. Wilson v_, Feb 18 2002

%E Edited by _David W. Wilson_ and _Dean Hickerson_, Jun 08 2002