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.

A326923 a(n) is the number of iterations needed to reach 1 or 9 starting at n and using the map k -> (k/2 if k is even, otherwise k + (largest triangular number < k)). Set a(n) = -1 if the trajectory never reaches 1 or 9.

This page as a plain text file.
%I A326923 #33 Aug 27 2022 04:52:46
%S A326923 0,1,3,2,4,4,9,3,0,5,4,5,8,10,10,4,6,1,8,6,3,5,7,6,9,9,8,11,15,11,17,
%T A326923 5,19,7,19,2,27,9,41,7,33,4,39,6,47,8,10,7,12,10,9,10,14,9,12,12,14,
%U A326923 16,16,12,18,18,18,6,14,20,26,8,32,20,24,3,26,28,40,10,32
%N A326923 a(n) is the number of iterations needed to reach 1 or 9 starting at n and using the map k -> (k/2 if k is even, otherwise k + (largest triangular number < k)). Set a(n) = -1 if the trajectory never reaches 1 or 9.
%C A326923 It is conjectured that this algorithm will always terminate at 1 or 9.
%C A326923 _Jim Nastos_ verified the conjecture for n <= 64*10^5.
%C A326923 _Jim Nastos_ verified the conjecture for n <= 45248000.
%H A326923 Robert Israel, <a href="/A326923/b326923.txt">Table of n, a(n) for n = 1..10000</a>
%e A326923 For n = 11: 11+10=21; 21+15=36; 36/2=18; 18/2=9; taking 4 steps to reach 9, so a(11)=4.
%p A326923 LT:= proc(k) local n;
%p A326923    n:= ceil((sqrt(1+8*k)-1)/2);
%p A326923    n*(n-1)/2
%p A326923 end proc:
%p A326923 f:= proc(k) option remember; if k::even then 1+procname(k/2) else 1+procname(k+LT(k))fi
%p A326923 end proc:
%p A326923 f(1):=0: f(9):= 0:
%p A326923 map(f, [$1..100]); # _Robert Israel_, Oct 23 2019
%t A326923 LT[k_] := Module[{n}, n = Ceiling[(Sqrt[1+8k]-1)/2]; n(n-1)/2]; f[k_] := f[k] = If[EvenQ[k], 1+f[k/2], 1+f[k+LT[k]]]; f[1] = 0; f[9] = 0;
%t A326923 Array[f, 100] (* _Jean-François Alcover_, Aug 27 2022, after _Robert Israel_ *)
%Y A326923 Cf. A006577, A057944, A326823, A326825.
%K A326923 nonn,look
%O A326923 1,3
%A A326923 _Ali Sada_, Oct 21 2019