login
Least n-digit multiple of n such that the r-th digit is prime if r is a prime else it is composite. The location and value of the most significant digit is 1. 0 if no such number exists.
2

%I #14 Dec 05 2013 19:57:07

%S 1,12,123,1224,12245,122424,1224265,12242424,122424246,0,12242424447,

%T 122424244428,1224242444243,12242424442458,0,1224242444242448,

%U 12242424442424692,122424244424244828,1224242444242444367,0

%N Least n-digit multiple of n such that the r-th digit is prime if r is a prime else it is composite. The location and value of the most significant digit is 1. 0 if no such number exists.

%C a(5*t)=0, for all t>1. This is because the last digit of 5*t is always 0 or 5 yet we require this digit to be composite for t>1. There are no other zero terms below a(10000). Conjecture: No other term is zero.

%C Because 0 is neither prime nor composite, it does not appear in any nonzero term. The digit 1 may appear only as the first digit of a term.

%H Sean A. Irvine, <a href="/A113572/b113572.txt">Table of n, a(n) for n = 1..1000</a>

%e a(6) = 122424, the first digit is 1, the 2nd, 3rd and the 5th digits are primes and the 4th and 6th digit are composite.

%t okQ[n_]:=Module[{d=IntegerDigits[n],ok,i=1}, ok=(d[[1]]==1); While[i<Length[d]&&ok,i++; ok=If[PrimeQ[i], MemberQ[{2,3,5,7},d[[i]]], MemberQ[{4,6,8,9},d[[i]]]]]; ok]; Table[mn=Ceiling[10^(n-1)/n]; mx=Floor[(10^n-1)/n]; i=mn; While[i<mx&&!okQ[i*n], i++]; If[i<=mx, i*n,0], {n,8}] (* slow *)

%Y Cf. A113573.

%K base,easy,nonn

%O 1,2

%A _Amarnath Murthy_, Nov 06 2005

%E Corrected and extended by _R. J. Mathar_, Aug 29 2007

%E More terms from _Sean A. Irvine_, Jan 17 2011