|
|
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).
|
|
7
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,3
|
|
COMMENTS
|
Sequence gives smallest term with desired property.
For n=2 and 10, there is only one such number.
For n=4, there are 2 solutions: 27 and 57, the latter 321(4).
For n=6, there are 2 solutions: 2285 and 7465, the latter 54321(6).
For n=8, there are 3 solutions: 874615, 1391089 and 1538257, these last two being 5234761(8) and 5674321(8).
There are no solutions for a number system of base n, if n is odd. For a solution the sum of the digits is always (n-1)*n/2. A solution is always divisible by n-1. This is only possible if the sum of the digits is divisible by n-1. As a consequence, n/2 has to be an integer and therefore n has to be even (translated from 2nd link from German by web page author, Werner Brefeld). - Michel Marcus, Dec 09 2013
Is it true that a(n) = 0 for n > 14? - Chai Wah Wu, Jun 07 2015
For a solution in base n, if the k-th digit from the left is d, then gcd(d,n) = gcd(k,n). In particular, digits in even positions are even, and digits in odd positions are odd. - David Radcliffe, Apr 24 2016
If a(n) <> 0 and is expressed in base n, the middle digit must be n/2. - Thomas Kaeding, Sep 01 2019
|
|
LINKS
|
Albert Franck, Puzzles, see item 7.
|
|
FORMULA
|
|
|
EXAMPLE
|
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).
|
|
PROG
|
(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
....for a, b in vgen(n-1, n):
........return a
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|