A163574 Decimal expansion of smallest zeroless pandigital number in base n such that each k-digit substring (1 <= k <= n-1 = number of base-n digits) starting from the left, is divisible by k (or 0 if none exists).
1, 0, 27, 0, 2285, 0, 874615, 0, 381654729, 0, 0, 0, 559922224824157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 2
Examples
a(3) = 0, since the 2 possible zeroless numbers, 12 and 21 in base 3, are both odd numbers, so do not satisfy the condition for k=2. a(4) = 27, that is 123 in base 4, such that 1, 12, and 123 are respectively divisible by 1, 2 and 3. Expansion of each term in the corresponding base : 27 = 123 (4); 2285 = 14325 (6); 874615 = 3254167 (8); 381654729 = 381654729 (10); 559922224824157 = 9C3A5476B812D (14).
Links
- Blaine, How about a math puzzle?
- Werner Brefeld, Neunstellige Zahl und Teilbarkeit (in German).
- Albert Franck, Puzzles, see item 7.
Programs
-
PARI
a(n) = {n--; for (j=0, n!-1, perm = numtoperm(n, j); ok = 1; for (i=1, n, v = sum(k=1, i, perm[k]*(n+1)^(i-k)); if ((v % i), ok=0; break;);); if (ok, return(v)););} \\ Michel Marcus, Dec 01 2013
-
PARI
chka(n, b) = {digs = digits(n, b); for (i=1, #digs, v = sum(k=1, i, digs[k]*b^(i-k)); print(v, ": ", v/i); if (v % i, return (0));); return (1);} \\ Michel Marcus, Dec 02 2013
-
PARI
okdigits(v, i) = {for (j=1, i-1, if (v[i] == v[j], return (0));); return (1);} a(n) = {b = n; n--; v = vector(n, i, 0); i = 1; while (1, v[i]++; while (v[i] > n, v[i] = 0; i --; if (i==0, return (0)); v[i]++); curv = sum (j=1, i, v[j]*(b^(i-j))); if (! (curv % i), if (okdigits(v, i), if (i == n, return (sum (j=1, n, v[j]*(b^(n-j))))); i++;);););} \\ Michel Marcus, Dec 08 2013
-
Python
def vgen(n, b): if n == 1: t = list(range(1, b)) for i in range(1, b): u = list(t) u.remove(i) yield i, u else: for d, v in vgen(n-1, b): for g in v: k = d*b+g if not k % n: u = list(v) u.remove(g) yield k, u def A163574(n): for a, b in vgen(n-1, n): return a return 0 # Chai Wah Wu, Jun 07 2015
Formula
a(2n+1) = 0 (see proof in comment). - Michel Marcus, Dec 09 2013
Extensions
Corrected and edited by Michel Marcus, Dec 02 2013
More terms from Michel Marcus, Dec 09 2013
a(31)-a(41) from Chai Wah Wu, Jun 07 2015
a(42)-a(49) from David Radcliffe, Apr 24 2016
a(50)-a(53) from Kevin Thomas, Jun 11 2019
a(54)-a(57) from Thomas Kaeding, Sep 03 2019
Comments