cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-8 of 8 results.

A162502 Inverse permutation to A162501.

Original entry on oeis.org

1, 5, 9, 13, 17, 21, 25, 29, 33, 2, 3, 4, 8, 12, 16, 20, 24, 28, 32, 6, 7, 39, 40, 42, 44, 46, 48, 50, 52, 10, 11, 41, 57, 58, 60, 62, 64, 66, 68, 14, 15, 43, 59, 73, 74, 76, 78, 80, 82, 18, 19, 45, 61, 75, 87, 88, 90, 92, 94, 22, 23, 47, 63, 77, 89, 99, 100, 102, 104, 26, 27
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2009

Keywords

Comments

A162501(a(n)) = a(A162501(n)) = n.
a(a(n)) = A162504(n).

A162503 A162501(A162501(n)).

Original entry on oeis.org

1, 30, 31, 14, 10, 16, 6, 4, 11, 80, 81, 40, 12, 23, 32, 41, 2, 28, 82, 15, 20, 35, 53, 5, 21, 300, 301, 50, 13, 48, 84, 51, 3, 57, 75, 67, 76, 68, 60, 61, 19, 17, 24, 7, 29, 70, 36, 71, 104, 18, 49, 8, 58, 118, 808, 86, 9, 90, 42, 91, 92, 100, 63, 101, 44, 102, 94, 22, 85, 719
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2009

Keywords

Comments

Inverse of A162504: a(A162504(n)) = A162504(a(n)) = n;
A162501(n) = A162502(a(n)) = a(A162502(n)).

A184992 a(n) is the least positive integer not occurring earlier that shares a digit with a(n-1); a(1)=1.

Original entry on oeis.org

1, 10, 11, 12, 2, 20, 21, 13, 3, 23, 22, 24, 4, 14, 15, 5, 25, 26, 6, 16, 17, 7, 27, 28, 8, 18, 19, 9, 29, 32, 30, 31, 33, 34, 35, 36, 37, 38, 39, 43, 40, 41, 42, 44, 45, 46, 47, 48, 49, 54, 50, 51, 52, 53, 55, 56, 57, 58, 59, 65, 60, 61, 62, 63, 64, 66, 67, 68, 69, 76, 70, 71, 72, 73
Offset: 1

Views

Author

Eric Angelini, Dec 22 2011

Keywords

Comments

A permutation of the positive integers.

Crossrefs

a(n) = A107353(n) for n>=3. - Alois P. Heinz, Dec 22 2011
Cf. A227118 (inverse); A067581.

Programs

  • Haskell
    import Data.List (delete, intersect); import Data.Function (on)
    a184992 n = a184992_list !! (n-1)
    a184992_list = 1 : f 1 [2..] where
       f u vs = v : f v (delete v vs)
         where v : _ = filter (not . null . (intersect `on` show) u) vs
    -- Reinhard Zumkeller, Jul 01 2013
    
  • Mathematica
    FromDigits /@ Nest[Function[a, Append[a, Block[{k = 2, d}, While[Nand[FreeQ[a, #], IntersectingQ[a[[-1]], #]] &@ Set[d, IntegerDigits@ k], k++]; d]]], {{1}}, 73] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    A184992(n,show=0)={my(a=1,u=2^1);for(k=2,n,show && print1(a",");a=Set(Vec(Str(a))); for(j=2,9e9,bittest(u,j) && next;setintersect(Set(Vec(Str(j))),a) || next; u+=2^a=j; break));a}  \\ M. F. Hasler, Dec 22 2011
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        an, aset, mink = 1, {1}, 1
        while True:
            yield an
            digset = set(str(an))
            an = next(k for k in count(mink) if k not in aset and set(str(k))&digset)
            aset.add(an)
            while mink in aset: mink += 1
    print(list(islice(agen(), 74))) # Michael S. Branicky, Oct 03 2024

A162504 A162502(A162502(n)).

Original entry on oeis.org

1, 17, 33, 8, 24, 7, 44, 52, 57, 5, 9, 13, 29, 4, 20, 6, 42, 50, 41, 21, 25, 68, 14, 43, 73, 76, 80, 18, 45, 2, 3, 15, 90, 92, 22, 47, 77, 99, 102, 12, 16, 59, 94, 65, 79, 101, 110, 30, 51, 28, 32, 74, 23, 91, 111, 117, 34, 53, 83, 39, 40, 78, 63, 109, 118, 123, 36, 38, 72, 46, 48
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2009

Keywords

Comments

Inverse of A162503: a(A162503(n)) = A162503(a(n)) = n;
A162502(n) = A162501(a(n)) = a(A162501(n)).

A249494 Lexicographically earliest permutation of the positive integers such that the parity of the first digit of a(n+1) equals that of a(n)'s last digit.

Original entry on oeis.org

1, 3, 5, 7, 9, 10, 2, 4, 6, 8, 20, 21, 11, 12, 22, 23, 13, 14, 24, 25, 15, 16, 26, 27, 17, 18, 28, 29, 19, 30, 40, 41, 31, 32, 42, 43, 33, 34, 44, 45, 35, 36, 46, 47, 37, 38, 48, 49, 39, 50, 60, 61, 51, 52, 62, 63, 53, 54, 64, 65, 55, 56, 66, 67, 57, 58, 68, 69, 59, 70, 80, 81, 71, 72, 82, 83, 73, 74, 84, 85, 75, 76, 86, 87, 77, 78, 88, 89, 79, 90, 200
Offset: 1

Views

Author

M. F. Hasler, Oct 30 2014

Keywords

Comments

See A249506 for the inverse permutation.
See A249278 (and inverse A249279) for the variant based on nonnegative integers. A162501 is a variant based not on parity but on equality.

Crossrefs

Cf. A249506 (inverse permutation), A249278 (variant starting with 0), A249279 (inverse thereof), A162501 (variant based on equality of digits).
Cf. A000030 (initial digit), A010879 (final digit of n).

Programs

  • PARI
    a(n,a=1,u=0)=for(n=1,n,for(k=1,9e9, !bittest(u,k)&& k\10^(#Str(k)-1)==Mod(a,2)&& !print1(a=k",")&& break);u+=1<
    				

A249506 Inverse permutation to A249494 (= permutation of the positive integers such that the parity of the first digit of a(n+1) equals that of a(n)'s last digit).

Original entry on oeis.org

1, 7, 2, 8, 3, 9, 4, 10, 5, 6, 13, 14, 17, 18, 21, 22, 25, 26, 29, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 30, 33, 34, 37, 38, 41, 42, 45, 46, 49, 31, 32, 35, 36, 39, 40, 43, 44, 47, 48, 50, 53, 54, 57, 58, 61, 62, 65, 66, 69, 51, 52, 55, 56, 59, 60, 63, 64, 67, 68, 70, 73, 74, 77, 78, 81, 82, 85
Offset: 1

Views

Author

M. F. Hasler, Oct 30 2014

Keywords

Comments

See A249278 and A249279 for the variant based on nonnegative integers; A162501 is a variant based not on parity but on equality.

Crossrefs

Programs

  • PARI
    a=vector(#A249494);for(i=1,#a,A249494[i]<=#a&&a[A249494[i]]=i);a \\ Result only valid up to the first zero.

A319154 a(n) is the smallest nonnegative integer not yet in the sequence that starts with the ending digit of a(n-1); a(1)=0; initial zeros are dropped.

Original entry on oeis.org

0, 1, 10, 2, 20, 3, 30, 4, 40, 5, 50, 6, 60, 7, 70, 8, 80, 9, 90, 11, 12, 21, 13, 31, 14, 41, 15, 51, 16, 61, 17, 71, 18, 81, 19, 91, 100, 22, 23, 32, 24, 42, 25, 52, 26, 62, 27, 72, 28, 82, 29, 92, 200, 33, 34, 43, 35, 53, 36, 63, 37, 73, 38, 83, 39, 93, 300, 44, 45, 54
Offset: 1

Views

Author

Enrique Navarrete, Sep 25 2018

Keywords

Comments

Theorem: Every nonnegative number appears.
Proof: (Sketched by Enrique Navarrete, Sep 25 2018; completed by N. J. A. Sloane, Oct 27 2018)
(i) Sequence is infinite (dG, G=giant number, is always available)
(ii) As usual for these "lexicographically earliest distinct term sequences", for any k, there is a threshold n_k such that for all n > n_k, a(n) > k.
(iii) Some final digit (d, say) appears infinitely often. (Otherwise sequence would be finite.) If d=0, go to step (vi).
(iv) All numbers beginning with d appear (If dm were missing, find xd in sequence which is > dm and also > n_{dm}. Then term after xd would be dm, contradiction.)
(v) In particular, all numbers dm0 appear.
(vi) After a number ending in 0, the next number is the smallest missing number. So if x is missing, find dm0 > n_x, then the next term would be (0)x = x, a contradiction. QED

Examples

			a(2) = 1 since it is formed from a(1) = 0 as 01 = 1.
a(20) = 11 since it is the smallest number not yet in the sequence that starts with the ending digit 0 of a(19) = 90.
		

Crossrefs

Programs

  • Mathematica
    Nest[Append[#, Block[{k = 1}, While[Nand[FreeQ[#, k], If[# == 0, True, First@ IntegerDigits@ k == #] &@ Mod[#[[-1]], 10]], k++]; k]] &, {0}, 69] (* Michael De Vlieger, Oct 15 2018 *)
  • PARI
    nexta(v, x) = {my(d = x % 10, newa); for (i=0, oo, newa = eval(concat(Str(d), Str(i))); if (! vecsearch(v, newa), return (newa)););}
    lista(nn) = {lasta = 0; print1(lasta, ", "); va = [lasta]; for (n=1, nn, newa = nexta(va, lasta); print1(newa, ", "); va = vecsort(concat(va, newa)); lasta = newa;);} \\ Michel Marcus, Oct 15 2018

A353888 a(n) is the least positive integer not occurring earlier in the sequence that contains at least one digit not in a(n-1); a(1)=1.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 11, 21, 23, 24, 25, 26, 27, 28, 29, 30, 22, 31, 32, 34, 35, 36, 37, 38, 39, 40, 33, 41, 42, 43, 45, 46, 47, 48, 49, 50, 44, 51, 52, 53, 54, 56, 57, 58, 59, 60, 55, 61, 62, 63, 64, 65, 67, 68
Offset: 1

Views

Author

Sergio Pimentel, May 09 2022

Keywords

Comments

The sequence is finite. 1023456789 should be the last number in the sequence, although many smaller numbers should fail to appear. How many terms are in the complete sequence?
The last term is a(1023445778) = 1023456789, the least missing number is 1000000010. - Rémy Sigrist, Jun 03 2022
At that point, the least missing numbers containing the digits 2..9 are 1020001000, 1023001300, 1023401000, 1023450200, 1023456024, 1023456710, 1023456781, 1023456789, resp. - Michael S. Branicky, Aug 26 2022

Examples

			a(11)=12 since a(10)=10 and 12 is the smallest number not occurring earlier in the sequence that contains a digit (2) that is not in 10.
		

Crossrefs

Programs

  • PARI
    isok(k, prev) = {my(d=digits(k)); for (i=1, #d, if (!vecsearch(prev, d[i]), return(1));); return(0);}
    find(va, n) = {my(k=1, prev=Set(digits(va[n-1]))); while (vecsearch(Set(va), k) || !isok(k, prev), k++); k;}
    lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = find(va, n);); va;} \\ Michel Marcus, May 11 2022
    (C++) See Links section.
    
  • Python
    from itertools import count, islice
    def agen():  # generator of terms
        an, aset, mu, mink = 0, set(), [10, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1
        while set(str(an)) != set("0123456789"):
            notin = set("0123456789") - set(str(an))
            an = min(mu[i] for i in range(10) if str(i) in notin)
            yield an; aset.add(an)
            for i in range(10):  # update min unused containing digit i
                while mu[i] in aset or str(i) not in str(mu[i]): mu[i] += 1
            for k in range(mink, min(mu)): aset.discard(k)
            mink = min(mu)
    print(list(islice(agen(), 67))) # Michael S. Branicky, Aug 26 2022
Showing 1-8 of 8 results.