login
A262530
Numbers such that digits occur at most twice in decimal representation.
1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 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, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121
OFFSET
1,2
COMMENTS
a(n) = n for n <= 110; a(111) = 112.
Sequence is finite; last term is 99887766554433221100. There are approximately 10^15 terms in total. - Charles R Greathouse IV, Oct 20 2022
There are < 141709756697784 terms. - Michael S. Branicky, Oct 21 2022
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..91953, all terms <= 10^5
MATHEMATICA
nonDigRepQ[n_] := Max[{Take[Flatten[Tally[IntegerDigits[n]]], {2, -1, 2}]}] < 3; Select[Range[1111], nonDigRepQ[#] &] (* Ivan N. Ianakiev, Sep 25 2015 *)
PROG
(Haskell)
import Data.List (delete)
a262530 n = a262530_list !! (n-1)
a262530_list = filter f [1..] where
f = g d10' . show where
g _ [] = True
g ts (d:ds) = elem d ts && g (delete d ts) ds
d10' = d10 ++ d10; d10 = "0123456789"
(PARI) isok(n) = {my(v = vecsort(digits(n))); my(d = -1); for(i=1, #v, if (v[i] == d, rl++; if (rl > 2, return (0)); , d = v[i]; rl = 1); ); return (1); } \\ Michel Marcus, Sep 29 2015
(PARI) is(n)=my(d=vecsort(digits(n))); for(i=3, #d, if(d[i]==d[i-2], return(0))); 1 \\ Charles R Greathouse IV, Oct 20 2022
(Python)
from math import factorial
from itertools import islice
from sympy.utilities.iterables import multiset_combinations as mc
from sympy.utilities.iterables import multiset_permutations as mp
def agen():
yield from range(1, 100)
for digits in range(3, 21):
for f in "123456789":
r = "".join(sorted([f]+[d*2 for d in "0123456789" if d != f]))
s = set()
for c in mc(r, digits-1):
for p in mp(c):
s.add(int(f + "".join(p)))
yield from sorted(s)
print(list(islice(agen(), 120))) # Michael S. Branicky, Oct 21 2022
CROSSREFS
Cf. A010784.
Sequence in context: A254109 A317945 A292579 * A291179 A033619 A130734
KEYWORD
nonn,base,fini
AUTHOR
Reinhard Zumkeller, Sep 24 2015
STATUS
approved