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.

A349877 a(n) is the number of times the map x -> A353314(x) needs to be applied to n to reach a multiple of 3, or -1 if the trajectory never reaches a multiple of 3.

This page as a plain text file.
%I A349877 #23 Apr 14 2022 15:17:10
%S A349877 0,2,14,0,1,13,0,4,1,0,12,3,0,1,3,0,4,1,0,11,2,0,1,2,0,2,1,0,2,3,0,1,
%T A349877 3,0,10,1,0,4,5,0,1,7,0,3,1,0,3,2,0,1,2,0,2,1,0,2,4,0,1,9,0,3,1,0,3,4,
%U A349877 0,1,5,0,6,1,0,4,2,0,1,2,0,2,1,0,2,7,0,1,4,0,6,1,0,6,3,0,1,3,0,5,1,0,8,2,0
%N A349877 a(n) is the number of times the map x -> A353314(x) needs to be applied to n to reach a multiple of 3, or -1 if the trajectory never reaches a multiple of 3.
%C A349877 Equally, number of iterations of A353313 needed to reach a multiple of 3, or -1 if no multiple of 3 is ever reached. - _Antti Karttunen_, Apr 14 2022
%H A349877 Antti Karttunen, <a href="/A349877/b349877.txt">Table of n, a(n) for n = 0..19683</a>
%F A349877 From _Antti Karttunen_, Apr 14 2022: (Start)
%F A349877 If A010872(n) = 0 then a(n) = 0, otherwise a(n) = 1 + a(A353314(n)).
%F A349877 a(n) < A353311(n) for all n.
%F A349877 (End)
%e A349877 a(1) = 2 : 1 -> 4 -> 9 (as it takes two applications of A353314 to reach a multiple of three),
%e A349877 a(2) = 14 : 2 -> 5 -> 10 -> 19 -> 34 -> 59 -> 100 -> 169 -> 284 -> 475 -> 794 -> 1325 -> 2210 -> 3685 -> 6144
%e A349877 a(3) = 0 : 3 (as the starting point 3 is already a multiple of 3).
%e A349877 a(4) = 1 : 4 -> 9
%e A349877 a(7) = 4 : 7 -> 14 -> 25 -> 44 -> 75.
%o A349877 (Python)
%o A349877 import itertools
%o A349877 def f(n):
%o A349877     for i in itertools.count():
%o A349877         quot, rem = divmod(n, 3)
%o A349877         if rem == 0:
%o A349877             return i
%o A349877         n = (5 * quot) + rem + 3
%o A349877 (PARI)
%o A349877 A353314(n) = { my(r=(n%3)); if(!r,n,((5*((n-r)/3)) + r + 3)); };
%o A349877 A349877(n) = { my(k=0); while(n%3, k++; n = A353314(n)); (k); }; \\ _Antti Karttunen_, Apr 14 2022
%Y A349877 Cf. A010872, A349876, A353311, A353313.
%K A349877 nonn,easy
%O A349877 0,2
%A A349877 _Nicholas Drozd_, Dec 03 2021
%E A349877 Definition corrected and more terms from _Antti Karttunen_, Apr 14 2022