login
Numbers k such that Sum_{i=1..k} d(i) is coprime to d(k), where d(k) is the number of positive divisors of k.
2

%I #19 Oct 29 2023 14:57:03

%S 1,2,3,4,9,10,11,12,13,14,15,26,27,28,29,30,31,32,33,34,35,36,51,52,

%T 53,54,55,56,57,58,59,61,62,81,82,83,84,85,86,87,88,89,90,91,93,94,95,

%U 97,98,99,100,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135

%N Numbers k such that Sum_{i=1..k} d(i) is coprime to d(k), where d(k) is the number of positive divisors of k.

%C Sum_{k=1..n} d(k) = Sum_{k=1..n} floor(n/k) = A006218(n).

%H Robert Israel, <a href="/A140238/b140238.txt">Table of n, a(n) for n = 1..10000</a>

%p N:= 1000: # for terms <= N

%p T:= map(numtheory:-tau,[$1..N]):

%p S:= ListTools:-PartialSums(T):

%p select(t -> igcd(T[t],S[t])=1, [$1..N]); # _Robert Israel_, Oct 24 2023

%o (Python)

%o from math import gcd, isqrt

%o from sympy import divisor_count

%o def A140238_gen(startvalue=1): # generator of terms >= startvalue

%o return filter(lambda n: gcd(divisor_count(n),-(s:=isqrt(n))**2+(sum(n//k for k in range(1,s+1))<<1))==1,count(max(startvalue,1)))

%o A140238_list = list(islice(A140238_gen(),30)) # _Chai Wah Wu_, Oct 23 2023

%o (PARI) isok(k) = gcd(sum(i=1, k, k\i), numdiv(k)) == 1; \\ _Michel Marcus_, Oct 29 2023

%Y Cf. A000005, A006218, A140237.

%K nonn

%O 1,2

%A _Leroy Quet_, May 14 2008

%E Extended by _Ray Chandler_, Jun 25 2009

%E Name edited by _Michel Marcus_, Oct 29 2023