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.

A385109 If n is 5 (mod 8) then apply n = (n-1)/4 until the result is not equivalent 5 (mod 8); otherwise a(n) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 1, 6, 7, 8, 9, 10, 11, 12, 3, 14, 15, 16, 17, 18, 19, 20, 1, 22, 23, 24, 25, 26, 27, 28, 7, 30, 31, 32, 33, 34, 35, 36, 9, 38, 39, 40, 41, 42, 43, 44, 11, 46, 47, 48, 49, 50, 51, 52, 3, 54, 55, 56, 57, 58, 59, 60, 15, 62, 63, 64, 65, 66, 67, 68, 17, 70, 71, 72, 73, 74, 75, 76, 19
Offset: 0

Views

Author

Ralf Stephan, Jun 18 2025

Keywords

Comments

a(8*n + 5) = A347840(n).

Examples

			a(37): n is 5 (mod 8), so n = (37-1)/4 = 9, which is 1 (mod 8), so a(37) = 9.
a(53): n is 5 (mod 8), so n = (53-1)/4 = 13, which is 5 (mod 8), so n = (13-1)/4 = 3, and, as 3 is 3 (mod 8), a(53) = 3.
		

Crossrefs

Cf. A347840.

Programs

  • Mathematica
    A385109[n_] := NestWhile[(# - 1)/4 &, n , Mod[#, 8] == 5 &];
    Array[A385109, 100, 0] (* Paolo Xausa, Jun 25 2025 *)
  • PARI
    a(n) = if(n%8!=5, n, m=n; while(m%8==5, m=(m-1)/4); m)

Formula

Recurrence: a(1) = 1, a(2n) = 2n, a(4n+3) = 4n+3, a(8n+1) = 8n+1, a(8n+5) = a(2n+1).