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.

A116922 a(n) = smallest integer >= n/2 which is coprime to n.

This page as a plain text file.
%I A116922 #26 Jul 31 2024 13:15:52
%S A116922 1,1,2,3,3,5,4,5,5,7,6,7,7,9,8,9,9,11,10,11,11,13,12,13,13,15,14,15,
%T A116922 15,17,16,17,17,19,18,19,19,21,20,21,21,23,22,23,23,25,24,25,25,27,26,
%U A116922 27,27,29,28,29,29,31,30,31,31,33,32,33,33,35,34,35,35,37,36,37,37,39,38
%N A116922 a(n) = smallest integer >= n/2 which is coprime to n.
%C A116922 A116921(n) + a(n) = n.
%C A116922 For n>= 3, a(n) - A116921(n) is 1 if n is odd, is 2 if n is a multiple of 4 and is 4 if n is congruent to 2 (mod 4).
%H A116922 Harvey P. Dale, <a href="/A116922/b116922.txt">Table of n, a(n) for n = 1..1000</a>
%H A116922 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).
%F A116922 For n >= 3, a(n) = (n+1)/2 if n is odd, a(n) = n/2 + 1 if n is a multiple of 4 and a(n) = n/2 + 2 if n is congruent to 2 (mod 4).
%F A116922 G.f.: t*(1 + t^2 + t^3 - t^4 + 2*t^5 - 2*t^6)/((1-t)*(1-t^4)). - _Mamuka Jibladze_, Aug 22 2019
%t A116922 cp[n_]:=Module[{k=Ceiling[n/2]},While[!CoprimeQ[n,k],k++];k]; Array[cp,80] (* _Harvey P. Dale_, Nov 06 2013 *)
%o A116922 (PARI) a(n) = {if(n%2, (n+1)/2, if(n==2, 1, n/2 + if(n%4, 2, 1)))} \\ _Andrew Howroyd_, Aug 22 2019
%o A116922 (Python)
%o A116922 def A116922(n): return n+1>>1 if n&1 or n==2 else (n>>1)+(2 if n&2 else 1) # _Chai Wah Wu_, Jul 31 2024
%Y A116922 Cf. A116921.
%K A116922 easy,nonn
%O A116922 1,3
%A A116922 _Leroy Quet_, Feb 26 2006
%E A116922 More terms from Wyatt Lloyd (wal118(AT)psu.edu), Mar 25 2006