A231720 a(0)=1, after which, for any n uniquely written as du*u! + ... + d2*2! + d1*1! (each di in range 0..i), a(n) = (du+1)*(u+1)! + ... + (d2+1)*3! + (d1+1)*2! + 1; the natural numbers with their factorial base representation (A007623) shifted left one step and each digit incremented by one, converted back to decimal.
1, 5, 15, 17, 21, 23, 57, 59, 63, 65, 69, 71, 81, 83, 87, 89, 93, 95, 105, 107, 111, 113, 117, 119, 273, 275, 279, 281, 285, 287, 297, 299, 303, 305, 309, 311, 321, 323, 327, 329, 333, 335, 345, 347, 351, 353, 357, 359, 393, 395, 399, 401, 405, 407, 417, 419
Offset: 0
Examples
1 has a factorial base representation A007623(1) = '1'. This shifted once left is '10', and when each digit is incremented by one, this will be '21', and 2*2! + 1*1! = 5 (also A007623(5) = '21'), thus a(1)=5. 2 has a factorial base representation '10'. This shifted once left is '100', and with each digit incremented, makes '211'. 2*3! + 1*2! + 1*1! = 15, thus a(2)=15.
Links
- Antti Karttunen, Table of n, a(n) for n = 0..10080
Programs
-
Scheme
;; Standalone iterative implementation: (define (A231720 n) (let loop ((n n) (z 1) (i 2) (f 2)) (cond ((zero? n) z) (else (loop (quotient n i) (+ (* f (+ 1 (remainder n i))) z) (+ 1 i) (* f (+ i 1)))))))