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.

A371880 Smallest number reachable starting from 1 and taking n steps either doubling or doubling+reversing.

This page as a plain text file.
%I A371880 #81 May 06 2024 18:58:22
%S A371880 1,2,4,8,16,23,46,29,58,71,34,68,37,47,49,89,79,59,19,38,67,35,7,14,
%T A371880 28,56,13,26,25,5,1,2,4,8,16,23,46,29,58,17,34,68,37,47,49,89,79,59,
%U A371880 19,38,67,35,7,14,28,56,13,26,25,5,1,2,4,8,16,23,46,29,58,17
%N A371880 Smallest number reachable starting from 1 and taking n steps either doubling or doubling+reversing.
%C A371880 At each step you are allowed to either double x -> 2*x or double and reverse x -> R(2*x), where R(x) = A004086(x) is decimal digit reversal.
%C A371880 From _Michael S. Branicky_, Apr 14 2024: (Start)
%C A371880 Since a(30) = 1 = a(0), a(n) <= a(n-30) for n >= 30. a(39) <= 17 < a(9) = 71 is the first term that strictly lowers the bound. Is it eventually periodic?
%C A371880 Under the map, a term k has preimage k/2 if k is even plus terms of the form R(k)*10^i/2 for i > 1 and for i=0 if R(k) is even. (End)
%C A371880 The condition above implies a(i+30k) is nonincreasing for k >= 0 for all i in 0..29, hence it is periodic (with period being a factor of 30). When does the periodic part of the sequence begin? - _Bryle Morga_, Apr 15 2024
%C A371880 From _David A. Corneth_, Apr 15 2024: (Start)
%C A371880 a(n) == 2^n (mod 9).
%C A371880 Because of this, all values 1 <= a(n) <= 9 have a(n + 30*k) = a(n). That is a(30*k) = 1, a(30*k + 1) = 2, a(30*k + 2) = 4, a(30*k + 3) = 8, a(30*k + 22) = 7, a(30*k + 29) = 5, for k >= 0. (End)
%C A371880 Ultimately periodic sequence of period 30 with a(k+30)=a(k) for k != 9. - _David Wilson_, Apr 19 2024
%H A371880 David A. Corneth, <a href="/A371880/a371880.gp.txt">PARI program</a>.
%H A371880 Bryle Morga et al., <a href="https://math.stackexchange.com/questions/4899315/optimal-strategy-in-a-game-where-doubling-and-doublingreversing-are-the-allowed/4901445#4901445">Optimal strategy in a game where Doubling and Doubling+Reversing are the allowed moves</a>.
%H A371880 <a href="/index/Rec#order_30">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1).
%F A371880 a(n) = f(1, n) where f(k, 0) = k and f(k, n) = min(f(2*k, n-1), f(R(2*k), n-1)).
%F A371880 a(30k) = 1 for k >= 0. - _Michael S. Branicky_, Apr 14 2024
%F A371880 a(9) = 71. For k != 9, a(k) is the minimum of the positive residues mod 99 of 2^k and 10*2^k. - _David Wilson_, Apr 19 2024
%e A371880 a(20) = 67 and here is the 20-move combination that reaches 67: 1, 2, 4, 8, 61, 221, 244, 884, 8671, 17342, 48643, 97286, 275491, 289055, 11875, 23750, 47500, 95000, 190000, 380000, 67.
%e A371880 a(21) = 35 and here is the 21-move combination that reaches 35: 1, 2, 4, 8, 61, 221, 244, 884, 8671, 17342, 48643, 97286, 275491, 289055, 11875, 23750, 47500, 95000, 91, 281, 265, 35.
%e A371880 a(30) = 1 using the path: 1, 2, 4, 8, 61, 122, 442, 488, 976, 2591, 2815, 365, 37, 47, 49, 98, 196, 392, 487, 479, 859, 1718, 3436, 2786, 2755, 155, 13, 26, 25, 5, 1. - _Michael S. Branicky_, Apr 14 2024
%o A371880 (Python)
%o A371880 def f(k, d):
%o A371880       if d == 0:
%o A371880             return k
%o A371880       else:
%o A371880             return min(f(2*k, d-1), f(int(str(2*k)[::-1]), d - 1))
%o A371880 def a(n):
%o A371880       return f(1, n)
%o A371880 for n in range(25):
%o A371880       print(a(n))
%o A371880 (Python)
%o A371880 from itertools import islice
%o A371880 def reverse(n): return int(str(n)[::-1])
%o A371880 def agen(): # generator of terms
%o A371880     reach = {1}
%o A371880     while True:
%o A371880         yield min(reach)
%o A371880         newreach = set()
%o A371880         for q in reach: newreach.update([2*q, reverse(2*q)])
%o A371880         reach = newreach
%o A371880 print(list(islice(agen(), 28))) # _Michael S. Branicky_, Apr 14 2024
%o A371880 (PARI) \\ See PARI link
%Y A371880 Cf. A000079, A004086, A004094, A036447, A371966.
%K A371880 nonn,base,easy
%O A371880 0,2
%A A371880 _Bryle Morga_, Apr 14 2024
%E A371880 a(27)-a(34) from _Michael S. Branicky_, Apr 14 2024
%E A371880 a(35) and beyond from _David Wilson_, Apr 19 2024