A367607 Comma-successor to n working in base 3, and written in base 3, or -1 if n has no successor.
12, 100, 11, -1, 110, 22, 102, 120, 101, 112, 201, 111, 122, 211, 121, 210, 221, 202, 220, 1000, 212, -1, 1010, 222, 1002, 1020, 1001, 1012, 1100, 1011, 1022, 1110, 1021, 1102, 1120, 1101, 1112, 1200, 1111, 1122, 1210, 1121, 1202, 1220, 1201, 1212, 2001, 1211, 1222, 2011, 1221, 2010, 2021, 2002, 2020, 2101, 2012, 2100
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Python
from sympy.ntheory.factor_ import digits def a(n): b = n + 3*(n%3) return next((int("".join(map(str, d3))) for y in [1, 2] if (d3:=digits(b+y, 3)[1:])[0] == y), -1) print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Dec 11 2023
Comments