cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A257081 a(n) = Number of iterations of A257080 needed, starting from n, before a fixed point is reached.

Original entry on oeis.org

0, 2, 1, 2, 0, 3, 1, 3, 1, 1, 2, 2, 0, 4, 2, 2, 0, 3, 0, 2, 3, 2, 0, 3, 1, 3, 1, 3, 1, 2, 1, 4, 1, 1, 7, 3, 1, 6, 1, 3, 2, 5, 1, 4, 1, 1, 2, 3, 0, 4, 2, 2, 0, 4, 2, 2, 9, 10, 4, 8, 0, 6, 3, 3, 0, 6, 0, 3, 6, 3, 0, 6, 0, 2, 2, 2, 0, 3, 2, 2, 2, 2, 1, 3, 0, 1, 3, 1, 0, 2, 0, 2, 2, 3, 0, 4, 0, 3, 8, 4, 0, 5, 6, 5, 3, 2, 6, 4, 0, 3, 1, 5, 0, 5, 0, 2, 2, 2, 0, 6, 1
Offset: 0

Views

Author

Antti Karttunen, Apr 15 2015

Keywords

Comments

Note: when at some point of iteration we reach some k whose factorial representation (A007623) does not contain any 1's, then at next step A257080(k) = 1*k, and thus a fixed point has been reached.

Examples

			For n = 5, with factorial representation A007623(5) = "21", the least missing nonzero digit is 3, thus A257080(5) = 3*5 = 15. 15 has factorial representation "211", so again we multiply by 3, resulting 3*15 = 45, with factorial representation "1311", thus the least missing nonzero digit is now 2, and 2*45 = 90, "3300" in factorial base, for which the least missing digit is 1, resulting 1*90 = 90 forever after, thus we have reached a fixed point after three iteration steps (5 -> 15 -> 45 -> 90) and a(5) = 3.
		

Crossrefs

A255411 gives the positions of zeros.

Programs

  • Scheme
    (define (A257081 n) (let loop ((oldn n) (n (A257080 n)) (s 1)) (if (= oldn n) s (loop n (A257080 n) (+ 1 s)))))
    ;; Alternative, recursive version, optionally using the memoizing definec-macro:
    (definec (A257081 n) (if (= 1 (A257079 n)) 0 (+ 1 (A257081 (A257080 n)))))

Formula

If A257079(n) = 1, a(n) = 0, otherwise, a(n) = 1 + a(A257080(n)).

A255411 Shift factorial base representation of n one digit left (with 0 added to right), increment all nonzero digits by one, then convert back to decimal; Numbers with no digit 1 in their factorial base representation.

Original entry on oeis.org

0, 4, 12, 16, 18, 22, 48, 52, 60, 64, 66, 70, 72, 76, 84, 88, 90, 94, 96, 100, 108, 112, 114, 118, 240, 244, 252, 256, 258, 262, 288, 292, 300, 304, 306, 310, 312, 316, 324, 328, 330, 334, 336, 340, 348, 352, 354, 358, 360, 364, 372, 376, 378, 382, 408, 412, 420, 424, 426, 430, 432, 436, 444
Offset: 0

Views

Author

Antti Karttunen, Apr 16 2015

Keywords

Comments

Nonnegative integers such that the number of ones (A257511) in their factorial base representation (A007623) is zero.
Nonnegative integers such that the least missing nonzero digit (A257079) in their factorial base representation is one.
a(n) can be also directly computed from n by "shifting left" its factorial base representation (that is, by appending one zero to the right, see A153880) and then incrementing all nonzero digits by one, and then converting the resulting (still valid) factorial base number back to decimal. See the examples.
The sequences A227130 and A227132 are closed under a(n), in other words, permutation listed as the a(n)-th entry in tables A060117 & A060118 has the same parity as the n-th entry in those same tables.

Examples

			Factorial base representation (A007623) of 1 is "1", shifting it left yields "10", and when we increment all nonzero digits by one, we get "20", which is the factorial base representation of 4 (as 4 = 2*2! + 0*1!), thus a(1) = 4.
F.b.r. of 2 is "10", shifting it left yields "100", and "200" is f.b.r. of 12, thus a(2) = 12.
F.b.r. of 43 is "1301", shifting it left and incrementing all nonzeros by one yields "24020", which is f.b.r of 340, thus a(43) = 340.
		

Crossrefs

Complement: A256450.
Positions of ones in A257079, fixed points of A257080, positions of zeros in A257511, A257081 and A257261.
Cf. also A227130/A227132, A060117/A060118 and also arrays A257503 & A257505.

Programs

  • Mathematica
    factBaseIntDs[n_] := Module[{m, i, len, dList, currDigit}, i = 1; While[n > i!, i++]; m = n; len = i; dList = Table[0, {len}]; Do[currDigit = 0; While[m >= j!, m = m - j!; currDigit++]; dList[[len - j + 1]] = currDigit, {j, i, 1, -1}]; If[dList[[1]] == 0, dList = Drop[dList, 1]]; dList]; s = Table[FromDigits[factBaseIntDs[n]], {n, 500}]; {0}~Join~Flatten@ Position[s, x_ /; DigitCount[x][[1]] == 0](* Michael De Vlieger, Apr 27 2015, after Alonso del Arte at A007623 *)
    Select[Range[0, 444], ! MemberQ[IntegerDigits[#, MixedRadix[Reverse@ Range@ 12]], 1] &] (* Michael De Vlieger, May 30 2016, Version 10.2 *)
    r = MixedRadix[Reverse@Range[2, 12]]; Table[FromDigits[Map[If[# == 0, 0, # + 1] &, IntegerDigits[n, r]]~Join~{0}, r], {n, 0, 60}] (* Michael De Vlieger, Aug 14 2016, Version 10.2 *)
  • Python
    from sympy import factorial as f
    def a007623(n, p=2): return n if n

    0 else '0' for i in x)[::-1] return 0 if n==0 else sum(int(y[i])*f(i + 1) for i in range(len(y))) print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 20 2017

A257079 The least nonzero digit missing from the factorial representation (A007623) of n.

Original entry on oeis.org

1, 2, 2, 2, 1, 3, 2, 2, 2, 2, 3, 3, 1, 3, 3, 3, 1, 3, 1, 2, 2, 2, 1, 4, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 1, 3, 1, 4, 4, 4, 1, 4, 1, 2, 2, 2, 1, 4, 2, 2, 2, 2, 4, 4, 1, 4, 4, 4, 1, 4, 1, 2, 2, 2, 1, 4, 1, 2, 2, 2, 1, 3, 2, 2, 2, 2, 3, 3, 1, 3, 3, 3, 1, 3, 1, 2, 2, 2, 1, 5, 2
Offset: 0

Views

Author

Antti Karttunen, Apr 15 2015

Keywords

Examples

			The least digit > 0 missing from the factorial representation (A007623) of zero, "0", is 1, thus a(0) = 1.
The least digit > 0 missing from the factorial representation of one, "1", is 2, thus a(1) = 2.
The least digit > 0 missing from the factorial representation of 21, "311", is 2, thus a(21) = 2.
		

Crossrefs

Cf. A033312 (the positions of records from a(1) onward.)
Cf. A255411 (the positions of ones.)

Programs

  • Mathematica
    a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; Min[Complement[Range[Max[s]+1], s]]]; a[0] = 1; Array[a, 100, 0] (* Amiram Eldar, Jan 24 2024 *)
  • Scheme
    (define (A257079 n) (let loop ((digs (uniq (sort (n->factbase n) <))) (mnp 1)) (cond ((null? digs) mnp) ((zero? (car digs)) (loop (cdr digs) mnp)) ((= (car digs) mnp) (loop (cdr digs) (+ 1 mnp))) (else mnp))))
    ;; Convert an integer to a factorial expansion list:
    (define (n->factbase n) (let loop ((n n) (fex (if (zero? n) (list 0) (list))) (i 2)) (cond ((zero? n) fex) (else (loop (floor->exact (/ n i)) (cons (modulo n i) fex) (1+ i))))))
    (define (uniq lista) (let loop ((lista lista) (z (list))) (cond ((null? lista) (reverse! z)) ((and (pair? z) (equal? (car z) (car lista))) (loop (cdr lista) z)) (else (loop (cdr lista) (cons (car lista) z))))))

Formula

Other identities:
For all n >= 1, a(A033312(n)) = n. [n! - 1 gives the first position where n appears. Note also how the digits in factorial base representation may get arbitrarily large values.]

A353512 n multiplied by the least nonzero digit missing from its primorial base representation.

Original entry on oeis.org

0, 2, 4, 6, 4, 15, 12, 14, 16, 18, 30, 33, 12, 39, 42, 45, 16, 51, 18, 38, 40, 42, 22, 92, 24, 50, 52, 54, 28, 87, 60, 62, 64, 66, 102, 105, 72, 74, 76, 78, 120, 123, 126, 129, 132, 135, 138, 141, 96, 98, 100, 102, 208, 212, 108, 110, 112, 114, 174, 177, 60, 183, 186, 189, 64, 195, 198, 201, 204, 207, 210, 213, 72
Offset: 0

Views

Author

Antti Karttunen, Apr 27 2022

Keywords

Examples

			19 in primorial base (A049345) is written as "301". The least missing nonzero digit is 2, thus A329028(19) = 2 and a(19) = 2*19 = 38.
		

Crossrefs

Cf. A049345, A328840 (the fixed points, positions where a(n) = n), A329028.
Cf. also A257080 for analogous sequence.

Programs

  • Mathematica
    a[n_] := Module[{k = n, p = 2, s = {}, r}, While[{k, r} = QuotientRemainder[k, p]; k != 0 || r != 0, AppendTo[s, r]; p = NextPrime[p]]; n * Min[Complement[Range[Max[s]+1], s]]]; a[0] = 0; Array[a, 100, 0] (* Amiram Eldar, Mar 13 2024 *)
  • PARI
    A329028(n) = { my(m=Map(), p=2); while(n, mapput(m,(n%p),1); n = n\p; p = nextprime(1+p)); for(k=1,oo,if(!mapisdefined(m,k),return(k))); };
    A353512(n) = (n * A329028(n));

Formula

a(n) = n * A329028(n).
Showing 1-4 of 4 results.