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.

A122002 a(0)=5; otherwise a(n) = (n mod 4) if n is odd, a(n) = h + 4, where h = (highest odd divisor of n) mod 4 if n is even.

Original entry on oeis.org

5, 1, 5, 3, 5, 1, 7, 3, 5, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 7, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 5, 1, 5, 3, 7, 1, 7, 3, 7, 1, 5, 3, 5, 1, 7, 3, 7, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 5, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 7, 1, 5, 3, 7, 1, 7, 3, 7, 1, 5, 3, 5
Offset: 0

Views

Author

N. J. A. Sloane, Aug 05 2008

Keywords

Comments

a(n) in {1,3,5,7} for all n. a(4k+i) = i if i is odd.
There is a typo in Grytczuk's definition: he has "+ 5" instead of "+ 4".

Crossrefs

Essentially the same: A112658 (map 1357 -> 0213), A125047 (map 1357 -> 2314).
Cf. A003324.

Programs

  • Mathematica
    a[0]=5;a[n_]:=If[OddQ[n],Mod[n,4],4+Mod[Select[Divisors[n],OddQ][[-1]],4]];Table[a[n],{n,0,100}] (* James C. McMahon, Oct 25 2024 *)
  • PARI
    a(n) = 2*if(n,bittest(n,valuation(n,2)+1)) + if(n%2,1,5); \\ Kevin Ryde, Sep 09 2020

Formula

Morphism 1 -> 5,3; 3 -> 7,3; 5 -> 5,1; 7 -> 7,1 starting from 5 [Carpi, h in remark after lemma 3.2]. - Kevin Ryde, Sep 09 2020

Extensions

Terms from a(26) on from John W. Layman, Aug 27 2008