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.
%I A325817 #17 Nov 24 2024 19:03:56 %S A325817 0,0,0,0,0,5,0,0,0,1,0,1,0,1,2,0,0,1,0,1,0,1,0,1,0,3,0,27,0,1,0,0,2,1, %T A325817 0,0,0,1,0,1,0,1,0,1,2,3,0,1,0,0,2,3,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1, %U A325817 2,1,0,1,0,1,0,3,0,1,0,1,0,1,0,1,0,3,2,1,0,1,2,1,0,1,2,5,0,0,2,0,0,1,0,1,2 %N A325817 a(n) is the least k >= 0 such that n-k and n-(sigma(n)-k) are relatively prime. %C A325817 a(n) is the least k >= 0 such that -n + k and (n-sigma(n))+k are coprime. %H A325817 Antti Karttunen, <a href="/A325817/b325817.txt">Table of n, a(n) for n = 1..65537</a> %H A325817 <a href="/index/Si#SIGMAN">Index entries for sequences related to sigma(n)</a> %F A325817 a(n) = A000203(n) - A325818(n) = A001065(n) - A325826(n) = n - A325976(n). %F A325817 For all n: %F A325817 a(A000396(n)) = A000396(n)-1. %F A325817 a(n) <= n-1. %F A325817 a(n) <= A325965(n). %F A325817 a(n) <= A325967(n). %e A325817 For n=15, gcd(15-0, 15-(24-0)) = 3, gcd(15-1, 15-(24-1)) = 2 and gcd(15-2, 15-(24-2)) = 1, thus a(15) = 2. %t A325817 lk[n_]:=Module[{k=0},While[!CoprimeQ[n-k,n-(DivisorSigma[1,n]-k)],k++];k]; Array[lk,110] (* _Harvey P. Dale_, Nov 24 2024 *) %o A325817 (PARI) A325817(n) = { my(s=sigma(n)); for(k=0, s, if(1==gcd(-n + k, (n-s)+k), return(k))); }; %o A325817 (PARI) A325817(n) = { my(s=sigma(n)); for(i=0, s, if(1==gcd(n-i, n-(s-i)), return(i))); }; %Y A325817 Cf. A000203, A000396, A001065, A009194, A014567 (positions of zeros), A324213, A325818, A325826, A325962, A325965, A325967, A325976. %K A325817 nonn %O A325817 1,6 %A A325817 _Antti Karttunen_, May 29 2019