login
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
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
Eric Angelini, Make the average of two successive terms and look, personal blog "Cinquante signes" on blogspot.com, also posted that day on the math-fun mailing list, Sep 07 2022
Michael S. Branicky, Python program
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
print(list(islice(agen(), 101))) # Michael S. Branicky, Sep 10 2022
CROSSREFS
Sequence in context: A179650 A131214 A271833 * A104260 A334355 A338642
KEYWORD
nonn,base,easy
AUTHOR
Eric Angelini and M. F. Hasler, Sep 10 2022
STATUS
approved