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.

A352111 In the factorial base expansion of n, replace each place value, say k! with k > 0, by (-1)^(k-1) * k!.

Original entry on oeis.org

0, 1, -2, -1, -4, -3, 6, 7, 4, 5, 2, 3, 12, 13, 10, 11, 8, 9, 18, 19, 16, 17, 14, 15, -24, -23, -26, -25, -28, -27, -18, -17, -20, -19, -22, -21, -12, -11, -14, -13, -16, -15, -6, -5, -8, -7, -10, -9, -48, -47, -50, -49, -52, -51, -42, -41, -44, -43, -46, -45
Offset: 0

Views

Author

Rémy Sigrist, Mar 05 2022

Keywords

Comments

This sequence maps natural numbers uniquely onto integers.

Examples

			For n = 42:
- 42 = 1 * 4! + 3 * 3! + 0 * 2! + 0 * 1!,
- so a(42) = 1 * -4! + 3 * 3! + 0 * -2! + 0 * 1! = -6.
		

Crossrefs

See A053985, A065369, A073835, A352112 for similar sequences.

Programs

  • PARI
    a(n) = { my (f=1, v=0); for (r=2, oo, if (n, v+=f*(n%r); n\=r; f*=-r, return (v))) }