%I #27 Nov 23 2016 23:39:14
%S 16,13,7,7,5,5,5,4,4,3,3,3,3,3,3,3,2,3,3,2,3,3,3,2,2,2,3,2,2,2,2,2,2,
%T 2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,1,2,2,2,2,2,
%U 2,1,3,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2
%N Maximum number of times a nine-digit number with non-repeating, nonzero digits can be divided by the n-th prime until a non-integer result is returned.
%C Sequence was constructed with a simple game in mind, one done by hand or by calculator, where one takes a nine-digit number with non-repeating nonzero digits and divides it by three until a non-integer result is returned. The potential best play is then of interest for this game, or the maximum number of times three divides such a number. The sequence extends this idea to all primes under the same rules and outputs the maximum number of times the n-th prime divides a number in this form.
%C The largest such prime that would give a nonzero solution is the 6289143rd prime, namely 109739359.
%e For n=2, 3 divides 618597324 13 times, and this is the highest achievable valuation. In comparison, if the rules regarding nonzero and non-repeating were lifted, the number 3^18 = 387420489 would be allowed, and a(2) would be 18.
%p with(LinearAlgebra)*with(combinat)*with(numtheory):
%p A := permute(9):
%p B := 0:
%p for d to 6289143 do
%p a[d] := 0:
%p end do:
%p for i to factorial(9) do
%p B := ifactors(Determinant(Multiply(`<|>`(`<,>`(100000000), `<,>`(10000000), `<,>`(1000000), `<,>`(100000), `<,>`(10000), `<,>`(1000), `<,>`(100), `<,>`(10), `<,>`(1)), Transpose(convert(A[i], Matrix))))):
%p C := nops([op(B[2])]):
%p for j to C do
%p if a[pi(B[2, j, 1])] < B[2, j, 2] then
%p a[pi(B[2, j, 1])] := B[2, j, 2]:
%p end if:
%p end do:
%p end do:
%p seq(a[i], i = 1 .. 500);
%t s = FromDigits /@ Permutations@ Range@ 9; Table[Max@ Map[Length@ NestWhileList[#/Prime@ n &, #, IntegerQ] &, s], {n, 40}] - 2 (* _Michael De Vlieger_, Feb 23 2016 *)
%o (PARI) a(n) = {my(p=prime(n)); my(mv = 0); for (i=0, 9!, mv = max(valuation(subst(Pol(numtoperm(9,i)), x, 10), p), mv);); mv;} \\ _Michel Marcus_, Feb 26 2016
%K nonn,base
%O 1,1
%A _Aaron Benham_, Feb 21 2016
|