login
A275512
The consecutive sizes of the blocks of terms containing at least one digit "1" are given by the sequence itself.
1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 12, 13, 14, 22, 15, 16, 17, 18, 23, 19, 21, 31, 41, 51, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 71, 81, 91, 100, 101, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90
OFFSET
1,2
COMMENTS
The sequence starts with a(1) = 1 and is extended with the smallest integer not yet used that does not lead to a contradiction.
EXAMPLE
The blocks of terms including at least a digit "1" are indicated here by parentheses; the successive block-sizes are 1, 2, 3, 4, 5,... which reproduces the sequence itself: (1),2,3,4,5,6,7,8,9,(10,11),20,(12,13,14),22,(15,16,17,18),23,(19,21,31,41,51),24...
MAPLE
isA011531 := proc(n)
nops(convert(convert(n, base, 10), set) intersect {1}) > 0 ;
simplify(%) ;
end proc:
A011531_next := proc(n)
local a;
for a from n+1 do
if isA011531(a) then
return a;
end if;
end do:
end proc:
isA052383 := proc(n)
not isA011531(n) ;
end proc:
A052383_next := proc(n)
local a;
for a from n+1 do
if isA052383(a) then
return a;
end if;
end do:
end proc:
A275512grp1 := proc(a)
local idx1, n ;
idx1 := 0 ;
if isA052383(a) then
return 0;
end if;
for n from 1 do
if isA011531(A275512(n)) then
if n =1 then
idx1 := 1;
elif isA052383(A275512(n-1)) then
idx1 := idx1+1 ;
end if;
end if;
if A275512(n) = a then
return idx1 ;
end if;
end do:
end proc:
A275512 := proc(n)
option remember;
local a, aprev, prev1, grp1, d, seen, reqlen, npr;
if n =1 then
1;
else
for a from 2 do
seen := false;
for npr from 1 to n-1 do
if procname(npr) = a then
seen := true;
break;
end if;
end do:
if not seen then
aprev := procname(n-1) ;
if isA052383(aprev) then
return a;
else
prev1 := 0 ;
for d from 1 to n-1 do
if isA011531(procname(n-d)) then
prev1 := prev1+1 ;
else
break;
end if;
end do:
grp1 := A275512grp1(aprev) ;
reqlen := procname(grp1) ;
if reqlen > prev1 then
return A011531_next(aprev) ;
elif n-prev1-1 > 0 then
return A052383_next(procname(n-prev1-1)) ;
else
return 2 ;
end if;
end if;
end if;
end do;
end if;
end proc:
seq(A275512(n), n=1..100) ; # R. J. Mathar, Jul 31 2016
CROSSREFS
Sequence in context: A032980 A239217 A130571 * A332144 A339018 A303948
KEYWORD
nonn,base,less
AUTHOR
Eric Angelini, Jul 31 2016
STATUS
approved