login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

For all n >= 2, Sum_{2<=k<=n, gcd(k,n)>1} a(k) = 1. a(1)=1.
2

%I #21 Feb 22 2023 10:20:03

%S 1,1,1,0,1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-3,1,1,1,1,1,-3,-1,3,5,-1,1,-7,

%T 1,9,5,-1,5,-13,1,13,11,-5,1,-25,1,25,29,5,1,-53,19,19,53,23,1,-95,

%U -73,81,81,25,1,-119,1,119,27,1,113,-143,1,89,243,-69,1,-335,1,457,351,-81,145,-841,1,497,831,425,1,-1809,-883,1809

%N For all n >= 2, Sum_{2<=k<=n, gcd(k,n)>1} a(k) = 1. a(1)=1.

%H Antti Karttunen, <a href="/A124385/b124385.txt">Table of n, a(n) for n = 1..10000</a>

%F a(1) = 1, and for n > 1, a(n) = 1 - Sum_{2 <= k <= n-1} [gcd(k,n)>1]*a(k), where [ ] is the Iverson bracket. - _Antti Karttunen_, Feb 22 2023

%e The positive integers which are <= 6 and are not coprime to 6 are 2,3,4,6. And a(6) is such that a(2)+a(3)+a(4)+a(6) = 1, i.e. a(6) = 1 - (a(2)+a(3)+a(4)) = 1 - 2 = -1.

%e The positive integers which are <= 12 and are not coprime to 12 2,3,4,6,8,9,10,12. And a(12) is such that a(2)+a(3)+a(4)+a(6)+a(8)+a(9)+a(10)+a(12) = 1.

%t f[n_] := Select[Range[2, n], GCD[ #, n] > 1 &];g[l_] :=Append[l, 1 - Plus @@ l[[Most[f[Length[l] + 1]]]]];Nest[g, {1}, 85] (* _Ray Chandler_, Nov 13 2006 *)

%o (PARI)

%o up_to_n = 10000;

%o A124385list(up_to_n) = { my(v=vector(up_to_n)); v[1] = 1; for(n=2,up_to_n,v[n] = 1-sum(k=2,n-1,(gcd(k,n)>1)*v[k])); (v); };

%o v124385 = A124385list(up_to_n);

%o A124385(n) = v124385[n]; \\ _Antti Karttunen_, Feb 22 2023

%Y Cf. A124386.

%K sign

%O 1,18

%A _Leroy Quet_, Oct 29 2006

%E Extended by _Ray Chandler_, Nov 13 2006