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.

A081742 a(1)=1; then if n is a multiple of 3, a(n) = a(n/3) + 1; if n is not a multiple of 3 but even, a(n) = a(n/2) + 1; a(n) = a(n-1) + 1 otherwise.

This page as a plain text file.
%I A081742 #19 May 28 2023 08:45:31
%S A081742 1,2,2,3,4,3,4,4,3,5,6,4,5,5,5,5,6,4,5,6,5,7,8,5,6,6,4,6,7,6,7,6,7,7,
%T A081742 8,5,6,6,6,7,8,6,7,8,6,9,10,6,7,7,7,7,8,5,6,7,6,8,9,7,8,8,6,7,8,8,9,8,
%U A081742 9,9,10,6,7,7,7,7,8,7,8,8,5,9,10,7,8,8,8,9,10,7,8,10,8,11,12,7,8,8,8,8,9,8
%N A081742 a(1)=1; then if n is a multiple of 3, a(n) = a(n/3) + 1; if n is not a multiple of 3 but even, a(n) = a(n/2) + 1; a(n) = a(n-1) + 1 otherwise.
%C A081742 A stopping problem: number of steps to reach zero starting with n and applying: x -> x/3 if x is a multiple of 3, x -> x/2 if x is even and not a multiple of 3, x -> x-1 otherwise.
%H A081742 Robert Israel, <a href="/A081742/b081742.txt">Table of n, a(n) for n = 1..10000</a>
%F A081742 a(n)/log(n) is bounded.
%p A081742 f:= proc(n) option remember;
%p A081742  if n mod 3 = 0 then procname(n/3)+1
%p A081742  elif n::even then procname(n/2)+1
%p A081742  else procname(n-1)+1
%p A081742  fi
%p A081742 end proc:
%p A081742 f(1):= 1:
%p A081742 map(f, [$1..200]); # _Robert Israel_, Apr 17 2023
%t A081742 a[n_] := a[n] = Which[n == 1, 1, Divisible[n, 3], a[n/3]+1, EvenQ[n], a[n/2]+1, True, a[n-1]+1];
%t A081742 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, May 28 2023 *)
%K A081742 nonn,easy
%O A081742 1,2
%A A081742 _Benoit Cloitre_, Apr 07 2003