[go: up one dir, main page]

login
A318699
a(n) is the smallest nonnegative integer of opposite parity to n, not yet in the sequence, that shares a digit with a(n-1); a(0) = 1.
0
1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 90, 9, 92, 21, 2, 23, 20, 25, 22, 27, 24, 29, 26, 61, 6, 63, 30, 3, 32, 31, 34, 33, 36, 35, 38, 37, 70, 7, 72, 47, 4, 41, 40, 43, 42, 45, 44, 49, 46, 65, 50, 5, 52, 51, 54, 53, 56, 55, 58, 57, 74, 67, 60, 69, 62, 121, 28, 81, 8, 83, 48, 85, 68, 87, 76, 71, 78, 73, 130, 39, 94, 59, 96, 79, 98, 89, 80, 101, 0, 103, 100, 91, 102, 105, 104, 107, 106, 109, 108
OFFSET
0,2
COMMENTS
Conjecture: this is a permutation of the nonnegative integers.
The one-digit integers appear in the following order: 1,9,2,3,7,4,6,5,8,0.
EXAMPLE
a(1) = 10 since 10 is the smallest even integer not yet in the sequence that shares the digit 1 with a(0) = 1; a(2) = 11 since 11 is the smallest odd integer not yet in the sequence that shares the digit 1 with a(1) = 10.
PROG
(Python)
cur = [1]
while len(cur) < 100:
....for x in range(100000):
........flag = False
........if x not in cur:#not currently used
............if x % 2 != cur[-1] % 2:#opposite parity
................j = str(x)
................k = str(cur[-1])
................for a in k:
....................if a in j:
........................cur.append(x)
........................flag = True
........................break
........if flag:
............break
print(cur)
# David Consiglio, Jr., Oct 04 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Enrique Navarrete, Aug 31 2018
EXTENSIONS
Corrected and extended by David Consiglio, Jr., Oct 04 2018
STATUS
approved