cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A354988 a(n) = A345993(n) - A345992(n).

This page as a plain text file.
%I A354988 #21 Jun 17 2022 14:52:45
%S A354988 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 A354988 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 A354988 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 A354988 a(n) = A345993(n) - A345992(n).
%H A354988 Antti Karttunen, <a href="/A354988/b354988.txt">Table of n, a(n) for n = 1..20000</a>
%H A354988 Antti Karttunen, <a href="/A354988/a354988.txt">Data supplement: n, a(n) computed for n = 1..100000</a>
%t A354988 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 A354988 (PARI) A354988(n) = for(m=1, oo, if((m*(m+1))%n==0, return(gcd(n,1+m)-gcd(n,m))));
%o A354988 (Python 3.8+)
%o A354988 from math import gcd, prod
%o A354988 from itertools import combinations
%o A354988 from sympy import factorint
%o A354988 from sympy.ntheory.modular import crt
%o A354988 def A354988(n):
%o A354988     if n == 1:
%o A354988         return 0
%o A354988     plist = tuple(p**q for p, q in factorint(n).items())
%o A354988     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 A354988 Cf. A345992, A345993, A345995 (positions of negative terms), A354989 (their characteristic function).
%Y A354988 Absolute values differ from A076388 for the first time at n=60, where a(60) = -11, while A076388(60) = 7.
%K A354988 sign
%O A354988 1,3
%A A354988 _Antti Karttunen_, Jun 16 2022