login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A098067 Consider the succession of single digits of the positive integers: 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 ... (A007376). This sequence is the lexicographically earliest derangement of the positive integers that produces the same succession of digits. 6
12, 3, 4, 5, 6, 7, 8, 9, 10, 1, 112, 13, 14, 15, 16, 17, 18, 19, 20, 2, 122, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Derangement here means that a(n) != n.
LINKS
Eric Angelini, Jeux de suites, in Dossier Pour La Science, pp. 32-35, Volume 59 (Jeux math'), April/June 2008, Paris.
EXAMPLE
We must begin with "1,2,3,..." and we cannot have a(1) = 1, so the first possible term is "12". The next term must be the smallest available positive integer not leading to a contradiction, thus "3"; the next one will be "4"; etc. After a(10) = 1, we cannot have a(11) = 11, so we use "112" instead. We are not allowed to use "2" after "19" because the next term would have a leading zero, which is forbidden. - Eric Angelini, Aug 12 2008
MATHEMATICA
lim = 80; f[lst_List, k_] := Block[{L = lst, g, a = {}, m = 0}, g[] := {Set[m, First@ FromDigits@ Append[IntegerDigits@ m, First@ #]], Set[L, Last@ #]} &@ TakeDrop[L, 1]; Do[g[]; While[Or[m == Length@ a + 1, First@ L == 0, MemberQ[a, m]], g[]]; AppendTo[a, m]; m = 0, {k}]; a]; f[Flatten@ Map[IntegerDigits, Range@ lim], Floor[lim - 10^(Log10@ lim - 1)]] (* Michael De Vlieger, Nov 29 2015, Version 10.2 *)
PROG
(Perl) See Link section.
(Python)
from itertools import count
def diggen():
for k in count(1): yield from list(map(int, str(k)))
def aupton(terms):
g = diggen()
alst, aset, _, _, nextd = [12], {12}, next(g), next(g), next(g)
for n in range(2, terms+1):
an, nextd = nextd, next(g)
while an in aset or an == n or nextd == 0:
an, nextd = int(str(an) + str(nextd)), next(g)
alst.append(an); aset.add(an)
return alst
print(aupton(72)) # Michael S. Branicky, Dec 03 2021
CROSSREFS
Sequence in context: A126860 A010203 A129197 * A070604 A268592 A127146
KEYWORD
nonn,nice,base
AUTHOR
Eric Angelini, Sep 13 2004
EXTENSIONS
Corrected and extended by Jacques ALARDET and Eric Angelini, Aug 12 2008
Derangement wording introduced by Danny Rorabaugh, Nov 26 2015
Edited by Danny Rorabaugh, Nov 29 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 05:35 EDT 2024. Contains 371906 sequences. (Running on oeis4.)