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.

Previous Showing 31-36 of 36 results.

A055947 n - reversal of base 3 digits of n (written in base 10).

Original entry on oeis.org

0, 0, 0, 2, 0, -2, 4, 2, 0, 8, 0, -8, 8, 0, -8, 8, 0, -8, 16, 8, 0, 16, 8, 0, 16, 8, 0, 26, 0, -26, 20, -6, -32, 14, -12, -38, 32, 6, -20, 26, 0, -26, 20, -6, -32, 38, 12, -14, 32, 6, -20, 26, 0, -26, 52, 26, 0, 46, 20, -6, 40, 14, -12, 58, 32, 6, 52, 26, 0, 46, 20, -6, 64, 38, 12, 58, 32, 6, 52, 26, 0, 80, 0, -80, 56, -24, -104, 32, -48
Offset: 0

Views

Author

Henry Bottomley, Jul 18 2000

Keywords

Comments

a(n) is even.

Examples

			For n = 5, the reversal of base 3 digits of n (written in base 10) is 7. So, a(5) = 5 - 7 = -2. - _Indranil Ghosh_, Feb 01 2017
		

Crossrefs

Programs

  • Mathematica
    Table[n-FromDigits[Reverse[IntegerDigits[n,3]],3],{n,0,90}] (* Harvey P. Dale, May 14 2022 *)
  • PARI
    a(n) = n - fromdigits(Vecrev(digits(n, 3)), 3); \\ Michel Marcus, Aug 09 2019

Formula

a(n) = n - A030102(n).

A191780 Triangle G(n,k): the value of n written in base k with digits reversed (but written here in base 10) for 2 <= k <= n.

Original entry on oeis.org

1, 3, 1, 1, 4, 1, 5, 7, 5, 1, 3, 2, 9, 6, 1, 7, 5, 13, 11, 7, 1, 1, 8, 2, 16, 13, 8, 1, 9, 1, 6, 21, 19, 15, 9, 1, 5, 10, 10, 2, 25, 22, 17, 10, 1, 13, 19, 14, 7, 31, 29, 25, 19, 11, 1, 3, 4, 3, 12, 2, 36, 33, 28, 21, 12, 1, 11, 13, 7, 17, 8, 43, 41, 37, 31, 23, 13, 1, 7, 22, 11, 22, 14, 2, 49, 46, 41, 34, 25, 14, 1, 15, 7, 15, 3
Offset: 2

Views

Author

Juri-Stepan Gerasimov, Aug 02 2011

Keywords

Examples

			The triangle starts
  1;
  3, 1;
  1, 4, 1;
  5, 7, 5, 1;
  3, 2, 9, 6, 1;
		

Crossrefs

Cf. A007088..A007095, A030101 (column k=2), A030102 (column k=3), A030103 (column k=4).

Programs

  • Maple
    A191780 := proc(n,k) d := ListTools[Reverse](convert(n,base,k)) ; add( op(i,d)*k^(i-1),i=1..nops(d)) ;
    end proc: # R. J. Mathar, Aug 26 2011
  • Mathematica
    G[n_, k_] := IntegerDigits[n, k] // Reverse // FromDigits[#, k]&; Table[ G[n, k], {n, 2, 15}, {k, 2, n}] // Flatten (* Jean-François Alcover, Feb 10 2018 *)

Extensions

Corrected by R. J. Mathar, Aug 26 2011

A305877 Numbers in base 3 reversed.

Original entry on oeis.org

0, 1, 2, 1, 11, 21, 2, 12, 22, 1, 101, 201, 11, 111, 211, 21, 121, 221, 2, 102, 202, 12, 112, 212, 22, 122, 222, 1, 1001, 2001, 101, 1101, 2101, 201, 1201, 2201, 11, 1011, 2011, 111, 1111, 2111, 211, 1211, 2211, 21, 1021, 2021, 121, 1121, 2121, 221, 1221, 2221, 2
Offset: 0

Views

Author

David F. Marrs, Jun 13 2018

Keywords

Examples

			11 is 102 in base 3, and reversing it gives 201 = a(11).
		

Crossrefs

Cf. A004086 (in base 10), A007089, A030102 (when converted in base 10).

Programs

  • Maple
    a:= n-> parse(cat(convert(n, base, 3)[])):
    seq(a(n), n=0..75);  # Alois P. Heinz, Jun 17 2018
  • Mathematica
    Table[FromDigits@ Reverse@ IntegerDigits[n, 3], {n, 0, 54}] (* Giovanni Resta, Jun 13 2018 *)
  • PARI
    a(n) = fromdigits(Vecrev(digits(n, 3)), 10); \\ Michel Marcus, Jun 13 2018

Formula

a(n) = A004086(A007089(n)). - Felix Fröhlich, Jun 14 2018

A331303 Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j), where f(n) = min(n, A263273(n)), and A263273 is bijective base-3 reverse.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 18 2020

Keywords

Comments

Restricted growth sequence transform of A331173. See comments in that sequence.

Crossrefs

Cf. also A331300.

Programs

  • PARI
    up_to = 100000;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A030102(n) = { my(r=[n%3]); while(0A263273 = n -> if(!n,n,A030102(n/(3^valuation(n,3))) * (3^valuation(n, 3)));
    A331173(n) = min(n, A263273(n));
    v331303 = rgs_transform(vector(1+up_to,n,A331173(n-1)));
    A331303(n) = v331303[1+n];

A264386 Gergonne's 27-card trick with three piles: finding a card after three dealings with pile information.

Original entry on oeis.org

1, 10, 19, 4, 13, 22, 7, 16, 25, 2, 11, 20, 5, 14, 23, 8, 17, 26, 3, 12, 21, 6, 15, 24, 9, 18, 27
Offset: 0

Views

Author

Wolfdieter Lang, Dec 22 2015

Keywords

Comments

See the links for J. D. Gergonne's 27-card trick with three piles each of 9 cards. Putting the told pile (the one with the card to be found) at the top (t), the middle (m) or the bottom (b) at each of the three dealings with three piles allows 3^3 = 27 possibilities. They are ordered lexicographically using t = 0, m = 1 and b = 2. The a(n)-th card from the top of the 27-card pile at the end is the card to be found for these 27 possible shufflings. E.g., a(2) gives the number for the shuffling (2)_3 = 002 (in the three-position base-3 version): the told 9-pile is first put on top, then again on top and finally at the bottom, denoted by ttb. Then the searched card is the 19th from the top of the 27-card pile.
In the Gardner reference the numbers to be added to obtain a(n) are for t, m, b for the first dealing 1, 2, 3, for the second one 0, 3, 6 and the third one 0, 9, 18, respectively. Hence for a(2) corresponding to ttb one finds 1 + 0 + 18 = 19.
This sequence (with offset 1) is the following element of the symmetric group S_27 (in cycle notation of type 1^9 2^8): (1) (4) (7) (11) (14) (17) (21) (24) (27) (2,10) (3,19) (5,13) (6,22) (8,16) (9,25) (12,20) (15,23) (18,26).
a(0)..a(17) coincides with A030102(9)..A030102(26).

Examples

			The 27 possible positions for the told pile of 9 cards after the three dealings are ordered like
  ttt, ttm, ttb, tmt, tmm, tmb, tbt, tbm, tbb,
  mtt, mtm, mtb, mmt, mmm, mmb, mbt, mbm, mbb,
  btt, btm, btb, bmt, bmm, bmb, bbt, bbm, bbb.
  They correspond to the three-position version of n in base 3, for n=0..26.
The Gardner counting for mmb (n=14) is 2 + 3 + 18 = 23 = a(14). The formula uses (14)_3 = 112, reversed 211, written as decimal 2*9 + 1*3 + 1*1 = 18 + 3 + 1  = 22, adding 1 gives a(14) = 23.
		

References

  • M. Gardner, Mathematische Zaubereien, Dumont, 2004, pp. 50-52. Original: Mathematics, Magic and Mystery, Dover, 1956.

Crossrefs

Cf. A030102.

Formula

a(n) = (reversed((n)_3))_10 + 1, n = 0 .. 26, where (n)_3 is the three position version of n in base 3. E.g., (4)_3 = 011, reversed 110, as decimal 9+3+0 = 12, adding 1 gives a(4) = 13.
a(n) = n_1 + n_2 + n_3 with n_1 = 1, 2, 3, n_2 = 0, 3, 6 and n_3 = 0, 9, 18, for t, m, b, respectively, at the i-th dealing, i = 1, 2, 3.
E.g., tmm (or 011): a(4) = 1 + 3 + 9 = 13. (Gardner, p. 51.)

A309574 n-th prime minus its ternary (base 3) reversal.

Original entry on oeis.org

0, 2, -2, 2, -8, 0, -8, 8, 0, -26, -6, 6, -26, -6, -14, -26, -6, 14, 26, -6, 38, 26, -80, -128, -48, -80, -24, -128, 24, -80, 24, -80, -32, 24, -56, 0, 24, 80, -24, 0, -48, 80, 24, 80, -24, 104, 80, 80, 48, 104, 0, 24, 80, -398, -338, -278, -434, 18, -138
Offset: 1

Views

Author

Keywords

Comments

a(n) = 0 if and only if n is palindromic in base 3 - if and only if A000040(n) is in A014190.
As it occurs in its binary cousin, we observe that a scatter plot of this sequence shows parallelograms.
All terms are even. - Alois P. Heinz, Aug 08 2019

Crossrefs

Programs

  • Maple
    a:= n-> (p-> p-(l->add(l[-i]*3^(i-1), i=1..nops(l))
            )(convert(p, base, 3)))(ithprime(n)):
    seq(a(n), n=1..61);  # Alois P. Heinz, Aug 08 2019
  • Mathematica
    (# - IntegerReverse[#,3]) &@ Prime@ Range@ 60 (* Giovanni Resta, Aug 09 2019 *)
  • PARI
    a(n) = my(p=prime(n)); p - fromdigits(Vecrev(digits(p, 3)), 3); \\ Michel Marcus, Aug 09 2019
  • Python
    from sympy import primerange
    def rev(n, b):
        m = 0
        while n > 0:
            m, n = m*b+n%b, n//b
        return m
    n, aa = 1, 1
    while n <20:
        if aa in primerange(1,200):
            print(n, aa-rev(aa, 3))
            n = n+1
        aa = aa+1 # A.H.M. Smeets, Aug 09 2019
    

Formula

a(n) = A000040(n) - A030102(A000040(n)).
a(n) = A055947(A000040(n)).
Previous Showing 31-36 of 36 results.