A367618 a(n) is the unique k such that n is a comma-child of k in base 3, or -1 if k does not exist.
-1, -1, -1, 3, 1, 1, -1, 6, 2, 9, 7, 5, 12, 10, 8, 15, 13, 13, 11, 18, 16, 14, 21, 19, 17, 24, 20, 27, 25, 23, 30, 28, 26, 33, 31, 29, 36, 34, 32, 39, 37, 35, 42, 40, 38, 45, 43, 41, 48, 46, 44, 51, 49, 49, 47, 54, 52, 50, 57, 55, 53, 60, 58, 56, 63, 61, 59, 66, 64, 62, 69, 67, 65, 72, 70, 68, 75, 73, 71, 78, 74, 81, 79, 77, 84, 82
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
- Eric Angelini, Michael S. Branicky, Giovanni Resta, N. J. A. Sloane, and David W. Wilson, The Comma Sequence: A Simple Sequence With Bizarre Properties, arXiv:2401.14346, Youtube
Programs
-
Python
from functools import cache from sympy.ntheory.factor_ import digits def a(n, base=3): y = digits(n, base)[1] x = (n-y)%base k = n - y - base*x return k if k > 0 else -1 print([a(n) for n in range(1, 88)])
Formula
a(n) = n - y - b*((n-y) mod b) where b is the base and y is the first digit of a(n); it is said to exist if a(n) > 0, else undefined (here, -1).
Comments