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
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, 28, 1, 30, 31, -8, 15, -2, 5, 36, 17, 10, 3, 40, 1, 42, -7, -4, 21, 46, 13, 48, 23, -14, 9, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
MATHEMATICA
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 *)
PROG
(PARI) A354988(n) = for(m=1, oo, if((m*(m+1))%n==0, return(gcd(n, 1+m)-gcd(n, m))));
(Python 3.8+)
from math import gcd, prod
from itertools import combinations
from sympy import factorint
from sympy.ntheory.modular import crt
def A354988(n):
if n == 1:
return 0
plist = tuple(p**q for p, q in factorint(n).items())
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
CROSSREFS
Cf. A345992, A345993, A345995 (positions of negative terms), A354989 (their characteristic function).
Absolute values differ from A076388 for the first time at n=60, where a(60) = -11, while A076388(60) = 7.
Sequence in context: A319676 A049073 A076388 * A264977 A109680 A366373
KEYWORD
sign
AUTHOR
Antti Karttunen, Jun 16 2022
STATUS
approved

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 April 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)