login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A266193 Decrement by 1 all maximal digits in factorial base representation of n and then shift it one digit right. 14
0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 17, 17, 17, 17, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 22, 22, 23, 23, 23, 23, 22 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,7

COMMENTS

By "maximal digits" are here understood any digit k that occurs in position k, digit-positions numbered from the right and starting from 1. For example in A007623(677) = "53021", the digits "5" and "1" are maximal, because no larger digits will fit into those positions in a well-formed factorial base representation of a natural number.

LINKS

Antti Karttunen, Table of n, a(n) for n = 0..10080

Index entries for sequences related to factorial base representation

FORMULA

Other identities. For all n >= 0:

a(A153880(n)) = n.

EXAMPLE

    n     A007623(n)  [subtract 1 from max.digits      a(n)

        [in factorial  then shift one digit right]   [reinterpret

                 base]                                 in decimal]

    0         0     ->      0                         =  0

    1         1     ->      0                         =  0

    2        10     ->      1                         =  1

    3        11     ->      1                         =  1

    4        20     ->      1                         =  1

    5        21     ->      1                         =  1

    6       100     ->     10                         =  2

    7       101     ->     10                         =  2

    8       110     ->     11                         =  3

    9       111     ->     11                         =  3

   10       120     ->     11                         =  3

   11       121     ->     11                         =  3

   12       200     ->     20                         =  4

   13       201     ->     20                         =  4

   14       210     ->     21                         =  5

   15       211     ->     21                         =  5

   16       220     ->     21                         =  5

   17       221     ->     21                         =  5

   18       300     ->     20                         =  4

  ...

   23       321     ->     21                         =  5

  119      4321     ->    321                         = 23

PROG

(MIT/GNU Scheme)

(define (A266193 n) (let loop ((n n) (z 0) (i 2) (f 0)) (cond ((zero? n) z) (else (let ((d (remainder n i))) (loop (quotient n i) (+ z (* f (- d (if (< d (- i 1)) 0 1)))) (+ 1 i) (if (zero? f) 1 (* f (- i 1)))))))))

(Python)

from sympy import factorial as f

def a007623(n, p=2): return n if n<p else a007623(int(n/p), p+1)*10 + n%p

def a(n):

    x=str(a007623(n))[::-1]

    y="".join([str(i) if i + 1==int(x[i]) else x[i] for i in xrange(len(x))])[1:]

    return 0 if n==0 else sum([int(y[i])*f(i + 1) for i in xrange(len(y))])

print [a(n) for n in xrange(101)] # Indranil Ghosh, Jun 24 2017

CROSSREFS

Cf. A007623, A257684, A266123.

Left inverse of A153880.

Sequence in context: A156251 A116458 A093875 * A114214 A321318 A270362

Adjacent sequences:  A266190 A266191 A266192 * A266194 A266195 A266196

KEYWORD

nonn,base

AUTHOR

Antti Karttunen, Dec 23 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 21 04:59 EDT 2019. Contains 321364 sequences. (Running on oeis4.)