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.
a[n_] := Module[{k = n*(n+1)/2, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; Count[s, ?(# > 0 &)]]; Array[a, 100, 0] (* _Amiram Eldar, Feb 07 2024 *)
(define (A232094 n) (A060130 (A000217 n)))
a(47) = 1321 because 47 = 1*4! + 3*3! + 2*2! + 1*1!
a007623 n | n <= 36287999 = read $ concatMap show (a108731_row n) :: Int | otherwise = error "representation would be ambiguous" -- Reinhard Zumkeller, Jun 04 2012 (Scheme, R6RS standard) (define (A007623 n) (let loop ((n n) (s 0) (p 1) (i 2)) (if (zero? n) s (let ((d (mod n i))) (loop (/ (- n d) i) (+ (* p d) s) (* 10 p) (+ 1 i)))))) ;; In older Schemes use modulo instead of mod. - Antti Karttunen, Feb 13 2016
a := n -> if nargs<2 then a(n,2) elif n
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]; Table[FromDigits[factBaseIntDs[n]], {n, 0, 50}] (* Alonso del Arte, May 03 2006 *) lim = 50; m = 1; While[Factorial@ m < lim, m++]; m; IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]] & /@ Range@ lim (* Michael De Vlieger, Oct 11 2015, Version 10.2 *)
apply( a(n,p=2)=if(n
def a(n, p=2): return n if n
a(205) = a(1!*1 + 3!*2 + 4!*3 + 5!*1) = 1+2+3+1 = 7. [corrected by Shin-Fu Tsai, Mar 23 2021] From _Joerg Arndt_, Jun 17 2011: (Start) n: permutation inv. table a(n) cycles 0: [ 0 1 2 3 ] [ 0 0 0 ] 0 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given in A055089. Perm2InversionVector in A064039 Or alternatively: [seq(convert(Perm2InversionVector(PermRevLexUnrank(j)),`+`),j=0..119)]; # third Maple program: b:= proc(n, i) local q; `if`(n=0, 0, b(irem(n, i!, 'q'), i-1)+q) end: a:= proc(n) local k; for k while k!Alois P. Heinz, Nov 15 2012
a[n_] := Module[{s=0, i=2, k=n}, While[k > 0, k = Floor[n/i!]; s = s + (i-1)*k; i++]; n-s]; Table[a[n], {n, 0, 105}] (* Jean-François Alcover, Nov 06 2013, after Benoit Cloitre *)
a(n)=local(k,r);k=2;r=0;while(n>0,r+=n%k;n\=k;k++);r \\ Franklin T. Adams-Watters, May 13 2009
def a(n): k=2 r=0 while n>0: r+=n%k n=n//k k+=1 return r print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 19 2017, after PARI program
def A034968(n, p=2): return n if nA034968(n//p, p+1) + n%p print([A034968(n) for n in range(106)]) # Michael S. Branicky, Oct 27 2024
(define (A034968 n) (let loop ((n n) (i 2) (s 0)) (cond ((zero? n) s) (else (loop (quotient n i) (+ 1 i) (+ s (remainder n i))))))) ;; Antti Karttunen, Aug 29 2016
a(4) = 2 because 2! <= 4 < 3!.
a084558 n = a090529 (n + 1) - 1 -- Reinhard Zumkeller, Jan 05 2014
0, seq(m$(m*m!),m=1..5); # Robert Israel, Apr 27 2015
Table[m = 1; While[m! <= n, m++]; m - 1, {n, 0, 104}] (* Jayanta Basu, May 24 2013 *) Table[Floor[Last[Reduce[x! == n && x > 0, x]]], {n, 120}] (* Eric W. Weisstein, Sep 13 2024 *)
a(n)={my(m=0);while(n\=m++,);m-1} \\ R. J. Cano, Apr 09 2018
def A084558(n): i=1 while n: i+=1; n//=i return(i-1) print(list(map(A084558,range(101)))) # Natalia L. Skirrow, May 28 2023
a(1000) = a(1*6! + 2*5! + 1*4! + 2*3! + 2*2!) = (7-1)*6! + (6-2)*5! + (5-1)*4! + (4-2)*3! + (3-2)*2! = 4910. a(1397) = a(1*6! + 5*5! + 3*4! + 0*3! + 2*2! + 1*1!) = (7-1)*6! + (6-5)*5! + (5-3)*4! + (3-2)*2! + (2-1)*1! = 4491.
b = MixedRadix[Reverse@ Range[2, 12]]; Table[FromDigits[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #), b] &@ IntegerDigits[n, b], {n, 0, 82}] (* Version 10.2, or *) f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Range[# + 1] <= n &]; Most@ Rest[a][[All, 1]] /. {} -> {0}]; g[w_List] := Total[Times @@@ Transpose@ {Map[Times @@ # &, Range@ Range[0, Length@ w]], Reverse@ Append[w, 0]}]; Table[g[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #)] &@ f@ n, {n, 0, 82}] (* Michael De Vlieger, Aug 29 2016 *)
a(n)=my(s=0,d,k=2);while(n,d=n%k;n=n\k;if(d,s=s+(k-d)*(k-1)!);k=k+1);return(s)
from sympy import factorial as f def a(n): s=0 k=2 while(n): d=n%k n=(n//k) if d: s=s+(k - d)*f(k - 1) k+=1 return s print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 19 2017
(define (A225901 n) (let loop ((n n) (z 0) (m 2) (f 1)) (cond ((zero? n) z) (else (loop (quotient n m) (if (zero? (modulo n m)) z (+ z (* f (- m (modulo n m))))) (+ 1 m) (* f m)))))) ;; One implementing the first recurrence, with memoization-macro definec: (definec (A225901 n) (if (zero? n) n (+ (A276091 (A275736 n)) (A153880 (A225901 (A257684 n)))))) ;; Antti Karttunen, Aug 29 2016
In this table each row consists of A001563[n] permutations of (n+1) terms; i.e., we have (1/) 2,1/ 1,3,2; 3,1,2; 3,2,1; 2,3,1/ 1,2,4,3; 2,1,4,3; Append to each an infinite number of fixed terms and we get a list of rearrangements of natural numbers, but with only a finite number of terms permuted: 1/2,3,4,5,6,7,8,9,... 2,1/3,4,5,6,7,8,9,... 1,3,2/4,5,6,7,8,9,... 3,1,2/4,5,6,7,8,9,... 3,2,1/4,5,6,7,8,9,... 2,3,1/4,5,6,7,8,9,... 1,2,4,3/5,6,7,8,9,... 2,1,4,3/5,6,7,8,9,...
with(group); permul := (a,b) -> mulperms(b,a); PermUnrank3R := proc(r) local n; n := nops(factorial_base(r)); convert(PermUnrank3Raux(n+1,r,[]),'permlist',1+(((r+2) mod (r+1))*n)); end; PermUnrank3Raux := proc(n,r,p) local s; if(0 = r) then RETURN(p); else s := floor(r/((n-1)!)); RETURN(PermUnrank3Raux(n-1, r-(s*((n-1)!)), permul(p,[[n,n-s]]))); fi; end;
n A007623 polynomial encoded as a(n) ------------------------------------------------------- 0 0 0-polynomial (empty product) = 1 1 1 1*x^0 prime(1)^1 = 2 2 10 1*x^1 prime(2)^1 = 3 3 11 1*x^1 + 1*x^0 prime(2) * prime(1) = 6 4 20 2*x^1 prime(2)^2 = 9 5 21 2*x^1 + 1*x^0 prime(2)^2 * prime(1) = 18 6 100 1*x^2 prime(3)^1 = 5 7 101 1*x^2 + 1*x^0 prime(3) * prime(1) = 10 and: 23 321 3*x^2 + 2*x + 1 prime(3)^3 * prime(2)^2 * prime(1) = 5^3 * 3^2 * 2 = 2250.
a[n_] := Module[{k = n, m = 2, r, p = 2, q = 1}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, q *= p^r; p = NextPrime[p]; m++]; q]; Array[a, 100, 0] (* Amiram Eldar, Feb 07 2024 *)
Comments