|
|
A357043
|
|
Lexicographically earliest infinite sequence of distinct nonnegative integers such that neither a(n) nor a(n+1) share a digit with (a(n)+a(n+1))/2.
|
|
1
|
|
|
0, 1, 3, 5, 7, 2, 4, 6, 8, 10, 34, 9, 20, 42, 18, 30, 14, 31, 13, 35, 17, 33, 11, 37, 15, 39, 16, 38, 50, 22, 40, 26, 41, 19, 36, 52, 24, 46, 21, 45, 27, 44, 28, 58, 70, 23, 57, 25, 47, 29, 51, 73, 43, 60, 82, 12, 48, 62, 32, 56, 84, 49, 61, 83, 55, 71, 53, 75, 91, 63, 80, 54, 72, 90, 64, 81, 59
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
The restriction to positive indices yields the corresponding sequence of positive integers.
(We consider that (0+1)/2 = .5 without a leading 0, otherwise the 0-based sequence would start (0, 2, 4, ...).)
Some numbers will never occur, in particular no pandigital number can ever occur (and almost all numbers are pandigital!). [Thanks to Rémy Sigrist for this observation.]
|
|
LINKS
|
|
|
PROG
|
(PARI) A357043_first(N, U=0/*starting index*/, a=0)={vector(N, d, d=Set(digits(a)); for(k=valuation(U+1, 2), oo, bittest(U, k) || #setintersect(setunion(d, Set(digits(k))), Set(digits((a+k)*if(bittest(a+k, 0), 5, 1/2)))) || [a=k; break]); U+=1<<a; a)}
(Python) # see link for faster algorithm
from itertools import count, islice
def d(n): return set(str(n//2).lstrip("0")) | ({"5"} if n&1 else set())
def c(s, t, u): return (s | t) & u
def agen():
aset, k, mink = set(), 0, 1
for n in count(1):
an = k; yield an; aset.add(an); s, k = set(str(an)), mink
while k in aset or c(s, set(str(k)), d(an+k)): k += 1
while mink in aset: mink += 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|