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.

A231475 Largest integer less than 5 and coprime to n.

Original entry on oeis.org

4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 1, 4, 3, 4
Offset: 1

Views

Author

M. F. Hasler, Nov 09 2013

Keywords

Examples

			a(1)=4 because this is the largest integer less than 5 and it's coprime to n=1.
a(2)=3 because 4 is not coprime to 2 but 3 is.
a(6)=1 because no other positive integer n<4 is coprime to 6=2*3.
		

Crossrefs

Cf. A231471 (analog for 11), A231470 (analog for 10), A231155.

Programs

  • Mathematica
    Max[Table[If[CoprimeQ[#,d],d,0],{d,4}]]&/@Range[100] (* Harvey P. Dale, Aug 27 2022 *)
  • PARI
    A231475(n, m=5) = for(k=1, m, gcd(n, m-k)==1&&return(m-k));

Formula

a(2k+1) = 4 = 2*2.
a(2k) = 1 if 3|k, otherwise a(2k)=3. - Jon Perry, Nov 09 2013