A340271 Positive integers with no digit equal to 0 or 1 such that when one iterates x -> A340270(x) starting with n, one eventually enters a cycle containing an integer greater than 9.
25, 26, 28, 34, 35, 36, 38, 43, 46, 52, 53, 62, 63, 64, 82, 83, 236, 239, 246, 254, 296, 326, 329, 362, 392, 426, 462, 524, 542, 926, 962
Offset: 1
Examples
Iterating the function x->A340270(x) starting with 34 we get 34 --> 4^3 = 64 --> 6^4 = 1296 --> 296^1 = 296 --> 96^2 = 9216 --> 926^1 = 926 --> 96^2 = 9216. So 34 is in this sequence.
Crossrefs
Programs
-
Maple
leastdigit:=proc(n) min(convert(n,base,10)); end: locationdigit:=proc(n,d) local L,i; L:=convert(n,base,10); for i from 1 to nops(L) do if d = L[i] then return (nops(L)+1-i); fi; od: end: cutout:=proc(X,i) [seq(X[j],j=1..i-1),seq(X[j],j=i+1..nops(X))]; end: ToNum:=proc(X) add(X[i]*10^(nops(X)-i),i=1..nops(X)); end: removeleastdigit:=proc(n) local i,X; i:=locationdigit(n,leastdigit(n)); X:=ListTools:-Reverse(convert(n,base,10)); ToNum(cutout(X,i)); end proc: h:=proc(n) removeleastdigit(n)^leastdigit(n); end: F:=proc(N) local i,L; if h(N) = N then return [N]; fi; L:=[N]; for i from 1 do L:=[op(L),h(L[-1])]; if nops(L) > nops(convert(L,set)) then return L; fi; od: fail; end proc: G:=proc(X) if X[-1] < 10 then return "S"; else return "L"; fi; end proc: L:=NULL: for n from 1 to 1000 do sss:=convert(n,base,10): if has(0,sss) or has(1,sss) then next; fi; u:=F(n); if u = fail then print(n,u); break; fi; if G(u) = "L" then L:=L,n; fi; od: L;
-
PARI
[n | n<-[1..9999], vecmin(digits(n))>1 && orbit(n)[1]>9] \\ with: orbit(n, U=[n], m)={ while(n>9, my( m=vecmin(n=digits(n))); forstep( i=#n,1,-1, if( n[i]==m, n=fromdigits(n[^i])^m; break)); setsearch(U,n) && break; U=setunion(U,[n])); U} \\ M. F. Hasler, Jan 03 2021
-
Python
def ok(n): strn = str(n) if "0" in strn or "1" in strn: return False iterates = {n} n = A340270(n) while n not in iterates: iterates.add(n) n = A340270(n) repeated = n if n > 9: return True n = A340270(n) while n != repeated: n = A340270(n) if n > 9: return True return False print([n for n in range(1, 1001) if ok(n)]) # Michael S. Branicky, Jan 02 2021
Comments