login
Smallest exponent k>1 such that n and n^k have some digits in common.
5

%I #19 Jun 04 2024 11:04:03

%S 2,2,5,5,3,2,2,5,5,3,2,2,2,2,2,2,2,3,3,2,2,2,4,2,3,2,2,2,2,3,2,2,2,3,

%T 3,2,2,2,3,3,2,2,2,2,3,2,2,4,2,2,2,2,2,5,3,2,2,3,3,3,2,2,3,2,2,2,2,3,

%U 2,2,2,2,3,2,2,2,2,5,2,3,2,2,2,2,3,2,2

%N Smallest exponent k>1 such that n and n^k have some digits in common.

%C For all n, n^5-n is divisible by 10, and so n^5 == n (mod 10). Thus a(n) <= 5 for all n. - _Tom Edgar_, Jan 06 2015

%H Robert Israel, <a href="/A253600/b253600.txt">Table of n, a(n) for n = 0..10000</a>

%e For n=2, 2^k has no digit in common with 2 until k reaches 5 to give 32, hence a(2)=5.

%p f:= proc(n) local L,k;

%p L:= convert(convert(n,base,10),set);

%p for k from 2 do

%p if convert(convert(n^k,base,10),set) intersect L <> {} then

%p return k

%p fi

%p od

%p end proc:

%p map(f, [$0..100]); # _Robert Israel_, Mar 17 2020

%t seq={};Do[k=1;Until[ContainsAny[IntegerDigits[n],IntegerDigits[n^k]],k++];AppendTo[seq,k] ,{n,0,86}];seq (* _James C. McMahon_, Jun 04 2024 *)

%o (PARI) a(n) = {sd = Set(vecsort(digits(n))); k=2; while (#setintersect(sd, Set(vecsort(digits(n^k)))) == 0, k++); k;}

%Y Cf. sequences where a(n)=k: A103173 (k=5), A189056 (k=2), A253601 (k=3), A253602 (k=4).

%Y Cf. A373203.

%K nonn,base

%O 0,1

%A _Michel Marcus_, Jan 05 2015