A029790 None of the digits in k is present in k^2 or k^3.
2, 3, 7, 8, 22, 47, 53, 77, 92, 157, 187, 188, 192, 552, 558, 577, 707, 772, 922, 2522, 8338, 17177, 66888, 575757, 929522, 1717177, 8888588
Offset: 1
Examples
For k = 47, k^2 = 2209 and k^3 = 103823. 4 and 7 do not appear in either of these numbers.
Links
- Manfred Scheucher, corrected python script
Programs
-
Maple
filter:= proc(n) local S1,S23; S1:= convert(convert(n,base,10),set); S23:= convert(convert(n^2,base,10),set) union convert(convert(n^3,base,10),set); nops(S1 intersect S23)=0 end proc: select(filter,[$1..10^5]); # Robert Israel, Jul 14 2014
-
Mathematica
Select[Range@ 1000000, Intersection[IntegerDigits[#^2], IntegerDigits@ #] == {} && Intersection[IntegerDigits[#^3], IntegerDigits@ #] == {} &] (* Michael De Vlieger, Jul 23 2015 *)
-
PARI
isok(n) = d = vecsort(Set(digits(n))); dd = vecsort(Set(digits(n^2))); ddd = vecsort(Set(digits(n^3))); for (i=1, #d, if (vecsearch(dd, d[i]) || vecsearch(ddd, d[i]), return (0));); 1 \\ Michel Marcus, Jul 13 2014
-
PARI
is(n)=#setintersect(setunion(Set(digits(n^2)),Set(digits(n^3))), Set(digits(n)))==0 \\ Charles R Greathouse IV, Jul 23 2015
-
Python
def a(n): s = str(n) s2 = str(n**2) s3 = str(n**3) count = 0 for i in s: if s2.count(i) == 0 and s3.count(i) == 0: count += 1 else: break if count == len(s): return True n = 1 while n < 10**9: if a(n): print(n, end=', ') n += 1 # Derek Orr, Jul 13 2014
Comments