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.

A321464 Reverse nonzero digits in ternary expansion of n and convert back to decimal.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 19, 12, 13, 22, 21, 16, 25, 18, 11, 20, 15, 14, 23, 24, 17, 26, 27, 28, 55, 30, 31, 58, 57, 34, 61, 36, 37, 64, 39, 40, 67, 66, 49, 76, 63, 46, 73, 48, 43, 70, 75, 52, 79, 54, 29, 56, 33, 32, 59, 60, 35, 62, 45, 38, 65, 42, 41
Offset: 0

Views

Author

Rémy Sigrist, Nov 10 2018

Keywords

Comments

This sequence is a self-inverse permutation of nonnegative integers with fixed points A321473.
See A321474 for the decimal variant.
The binary variant simply corresponds to the identity (A001477).

Examples

			The first values at prime indices, alongside the corresponding ternary expansions, are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   2     2       2          2
   3     3      10         10
   5     7      12         21
   7     5      21         12
  11    19     102        201
  13    13     111        111
  17    25     122        221
  19    11     201        102
  23    23     212        212
  29    55    1002       2001
  31    31    1011       1011
  37    37    1101       1101
  41    67    1112       2111
  43    49    1121       1211
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{x = IntegerDigits[n, 3], t}, t = Flatten@ Position[x, 1 | 2]; x[[Reverse@ t]] = x[[t]]; FromDigits[x, 3]]; Array[a, 68, 0] (* Giovanni Resta, Sep 17 2019 *)
  • PARI
    a(n,base=3) = my (d=digits(n,base),t=Vecrev(select(sign,d)),i=0); for (j=1, #d, if (d[j], d[j] = t[i++])); fromdigits(d,base)

Formula

a(3 * n) = 3 * a(n).

A333659 a(n) is the greatest number m not yet in the sequence such that the decimal expansions of n and of m have the same digits (up to order but with multiplicity).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 12, 22, 32, 42, 52, 62, 72, 82, 92, 30, 13, 23, 33, 43, 53, 63, 73, 83, 93, 40, 14, 24, 34, 44, 54, 64, 74, 84, 94, 50, 15, 25, 35, 45, 55, 65, 75, 85, 95, 60, 16, 26, 36, 46, 56, 66, 76
Offset: 0

Views

Author

Rémy Sigrist, Sep 02 2020

Keywords

Comments

Leading 0's are ignored.
This sequence is a permutation of the nonnegative integers, which preserves the number of digits (A055642) and the sum of digits (A007953).
This sequence first differs from A321474 and A336956 for n = 101: a(101) = 110 whereas A321474(101) = A336956(101) = 101.

Examples

			For n = 255:
- there are three numbers with the same multiset of digits: 255, 525 and 552,
- so a(255) = 552,
     a(525) = 525,
     a(552) = 255.
		

Crossrefs

See A333658, A337305 and A337598 for similar sequences.
See A331274 for the binary variant.

Programs

  • PARI
    See Links section.

Formula

a(10^n) = 10^n for any n >= 0.

A336956 For any number n whose set of nonzero decimal digits is { d_0, ..., d_k } (with d_0 < ... < d_k), a(n) is obtained by replacing in the decimal representation of n each nonzero digit d_m by d_{k-m} for m = 0..k.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 12, 22, 32, 42, 52, 62, 72, 82, 92, 30, 13, 23, 33, 43, 53, 63, 73, 83, 93, 40, 14, 24, 34, 44, 54, 64, 74, 84, 94, 50, 15, 25, 35, 45, 55, 65, 75, 85, 95, 60, 16, 26, 36, 46, 56, 66, 76
Offset: 0

Views

Author

Rémy Sigrist, Aug 09 2020

Keywords

Comments

This sequence is a self-inverse permutation of nonnegative integers.
This sequence first differs from A321474 for n = 112: a(112) = 221 whereas A321474(112) = 211.
This sequence has similarities with A166166; here we consider nonzero decimal digits, there binary run-lengths.

Examples

			For n = 10251:
- the set of nonzero digits is { 1, 2, 5},
- so we replace each digit 1, 2, 5 respectively by 5, 2, 1,
- and a(10251) = 50215.
		

Crossrefs

Programs

  • PARI
    a(n, base=10) = { my (d=digits(n, base), s=Set(select(sign, d))); fromdigits(apply (t -> if (t, s[#s+1-setsearch (s,t)], 0), d), base) }

Formula

a(n) = n iff n = 0 or n belongs to A125289.

A352152 Reverse each run of consecutive nonzero digits in the decimal expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 12, 22, 32, 42, 52, 62, 72, 82, 92, 30, 13, 23, 33, 43, 53, 63, 73, 83, 93, 40, 14, 24, 34, 44, 54, 64, 74, 84, 94, 50, 15, 25, 35, 45, 55, 65, 75, 85, 95, 60, 16, 26, 36, 46, 56, 66, 76
Offset: 0

Views

Author

Rémy Sigrist, Mar 06 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.
This sequence first differs from A321474 for n = 102: a(102) = 102 whereas A321474(102) = 201.
This sequence first differs from A333659 for n = 101: a(101) = 101 whereas A333659(101) = 110.
This sequence first differs from A336956 for n = 102: a(102) = 102 whereas A336956(102) = 201.

Examples

			For n = 1024:
- we have two runs of consecutive nonzero digits: "1" and "24",
- the reverse of "1" is "1", that of "24" is "42",
- so a(1024) = 1042.
		

Crossrefs

Programs

  • Perl
    sub a { my $v = shift; $v =~ s/[1-9]+/reverse($&)/ge; return $v; }
    
  • Python
    from itertools import groupby
    def A352152(n): return int(''.join(''.join(list(g) if k else list(g)[::-1]) for k, g in groupby(str(n),key=lambda x:x =='0'))) # Chai Wah Wu, Mar 08 2022

Formula

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