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.

This page as a plain text file.
%I A385109 #21 Jun 25 2025 10:12:09
%S A385109 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,
%T A385109 27,28,7,30,31,32,33,34,35,36,9,38,39,40,41,42,43,44,11,46,47,48,49,
%U A385109 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
%N 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.
%C A385109 a(8*n + 5) = A347840(n).
%H A385109 Paolo Xausa, <a href="/A385109/b385109.txt">Table of n, a(n) for n = 0..10000</a>
%F A385109 Recurrence: a(1) = 1, a(2n) = 2n, a(4n+3) = 4n+3, a(8n+1) = 8n+1, a(8n+5) = a(2n+1).
%e A385109 a(37): n is 5 (mod 8), so n = (37-1)/4 = 9, which is 1 (mod 8), so a(37) = 9.
%e A385109 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.
%t A385109 A385109[n_] := NestWhile[(# - 1)/4 &, n , Mod[#, 8] == 5 &];
%t A385109 Array[A385109, 100, 0] (* _Paolo Xausa_, Jun 25 2025 *)
%o A385109 (PARI) a(n) = if(n%8!=5, n, m=n; while(m%8==5, m=(m-1)/4); m)
%Y A385109 Cf. A347840.
%K A385109 nonn
%O A385109 0,3
%A A385109 _Ralf Stephan_, Jun 18 2025