login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A354988 a(n) = A345993(n) - A345992(n). 4

%I #21 Jun 17 2022 14:52:45

%S 0,1,2,3,4,1,6,7,8,3,10,1,12,5,-2,15,16,7,18,1,4,9,22,-5,24,11,26,-3,

%T 28,1,30,31,-8,15,-2,5,36,17,10,3,40,1,42,-7,-4,21,46,13,48,23,-14,9,

%U 52,25,6,1,16,27,58,-11,60,29,-2,63,8,-5,66,13,-20,-9,70,1,72,35,22,-15,4,7,78,11,80,39,82,17,-12

%N a(n) = A345993(n) - A345992(n).

%H Antti Karttunen, <a href="/A354988/b354988.txt">Table of n, a(n) for n = 1..20000</a>

%H Antti Karttunen, <a href="/A354988/a354988.txt">Data supplement: n, a(n) computed for n = 1..100000</a>

%t a[n_] := Module[{m = 1}, While[!Divisible[m*(m + 1), n], m++]; GCD[n, m + 1] - GCD[n, m]]; Array[a, 100] (* _Amiram Eldar_, Jun 16 2022 *)

%o (PARI) A354988(n) = for(m=1, oo, if((m*(m+1))%n==0, return(gcd(n,1+m)-gcd(n,m))));

%o (Python 3.8+)

%o from math import gcd, prod

%o from itertools import combinations

%o from sympy import factorint

%o from sympy.ntheory.modular import crt

%o def A354988(n):

%o if n == 1:

%o return 0

%o plist = tuple(p**q for p, q in factorint(n).items())

%o return n-1 if len(plist) == 1 else -gcd(n,s:=int(min(min(crt((m, n//m), (0, -1))[0], crt((n//m, m), (0, -1))[0]) for m in (prod(d) for l in range(1, len(plist)//2+1) for d in combinations(plist, l))))) + gcd(n,s+1) # _Chai Wah Wu_, Jun 16 2022

%Y Cf. A345992, A345993, A345995 (positions of negative terms), A354989 (their characteristic function).

%Y Absolute values differ from A076388 for the first time at n=60, where a(60) = -11, while A076388(60) = 7.

%K sign

%O 1,3

%A _Antti Karttunen_, Jun 16 2022

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 09:35 EDT 2024. Contains 375511 sequences. (Running on oeis4.)