A306384 Start with n and repeatedly double it and apply the "delete any run of identical digits" operation described in A321801; a(n) is the number of steps needed to reach one of 0, 1, or 5, or -1 if none of these three numbers is ever reached.
0, 0, 19, 12, 18, 0, 11, 23, 17, 4, 19, 1, 10, 29, 22, 32, 16, 5, 3, 47, 18, 15, 1, 20, 9, 2, 28, 26, 21, 13, 31, 24, 15, 1, 4, 23, 2, 18, 46, 21, 17, 51, 14, 15, 1, 24, 19, 2, 8, 10, 1, 33, 27, 24, 25, 1, 20, 19, 12, 18, 30, 1, 23, 7, 14, 29, 6, 20, 3
Offset: 0
Examples
a(66) = 6: 66->132->264->528->1056->22->0. Contrast this with A323832(66) = 5: 66->132->264->528->1056->0.
Links
- Chai Wah Wu, Table of n, a(n) for n = 0..10000
Programs
-
Python
from re import split def A306384(n): mset, m, c = set(), n, 0 while True: if m == 1 or m == 0 or m == 5: return c m = int('0'+''.join(d for d in split('(0+)|(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)', str(2*m)) if d != '' and d != None and len(d) == 1)) if m in mset: return -1 mset.add(m) c += 1
Comments