OFFSET
1,2
COMMENTS
A121042(a(n)) = 1. - Reinhard Zumkeller, Jul 21 2006
See A043493 for numbers that contain a single digit '1'. A subsequence of numbers having a digit that divides all other digits, A263314. - M. F. Hasler, Jan 11 2016
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n) ~ n. - Charles R Greathouse IV, Nov 02 2022
MAPLE
M:= 3: # to get all terms of up to M digits
B:= {1}: A:= {1}:
for i from 2 to M do
B:= map(t -> seq(10*t+j, j=0..9), B) union
{seq(10*x+1, x=2*10^(i-2)..10^(i-1)-1)}:
A:= A union B;
od:
sort(convert(A, list)); # Robert Israel, Jan 10 2016
# second program:
A011531 := proc(n)
if n = 1 then
1;
else
for a from procname(n-1)+1 do
if nops(convert(convert(a, base, 10), set) intersect {1}) > 0 then
return a;
end if;
end do:
end if;
end proc: # R. J. Mathar, Jul 31 2016
MATHEMATICA
Select[Range[600] - 1, DigitCount[#, 10, 1] > 0 &] (* Vincenzo Librandi, Jan 11 2016 *)
PROG
(Haskell)
a011531 n = a011531_list !! (n-1)
a011531_list = filter ((elem '1') . show) [0..]
-- Reinhard Zumkeller, Feb 05 2012
(PARI) is_A011531(n)=setsearch(Set(digits(n)), 1) \\ M. F. Hasler, Jan 10 2016
(Magma) [n: n in [0..500] | 1 in Intseq(n) ]; // Vincenzo Librandi, Jan 11 2016
(GAP) Filtered([1..140], n->1 in ListOfDigits(n)); # Muniru A Asiru, Feb 23 2019
(Scala) (0 to 119).filter(_.toString.indexOf('1') > -1) // Alonso del Arte, Jan 12 2020
(Python)
def aupto(nn): return [m for m in range(1, nn+1) if '1' in str(m)]
print(aupto(133)) # Michael S. Branicky, Jan 10 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved