A235164 Numbers whose digits, when the number is written in base n+1, are a permutation of 1...n, and such that for all k in {1,...,n} the first k digits (still in base n+1) form a number divisible by k.
1, 27, 57, 2285, 7465, 874615, 1391089, 1538257, 381654729, 559922224824157
Offset: 1
Examples
The terms with 5 digits in base 6 are 2285 = 14325[6] and 7465 = 54321[6], since these numbers are divisible by 5, and 14[6] = 10, 143[6] = 63, 1432[6] = 380 are divisible by 2, 3 and 4, respectively, and the same is the case for 54[6] = 34, 543[6] = 207 and 5432[6] = 1244.
Programs
-
PARI
for(n=1,9,p=vector(n,i,(n+1)^(i-1));for(k=0,n!-1,d=numtoperm(n,k);for(j=2,n,sum(i=1,j,d[i]*p[j-i+1])%j &&next(2)); print1(d*vector(n,i,(n+1)^(n-i))~",")))
-
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 A235164_list = [a for n in range(2,15,2) for a, b in vgen(n-1,n)] # Chai Wah Wu, Jun 07 2015
Extensions
a(10) from Chai Wah Wu, Jun 07 2015
Comments