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-10 of 25 results. Next

A169930 Duplicate of A048379.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, 20, 31, 32, 33, 34, 35, 36
Offset: 0

Views

Author

Keywords

A002283 a(n) = 10^n - 1.

Original entry on oeis.org

0, 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, 9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999, 999999999999999, 9999999999999999, 99999999999999999, 999999999999999999, 9999999999999999999, 99999999999999999999, 999999999999999999999, 9999999999999999999999
Offset: 0

Views

Author

Keywords

Comments

A friend from Germany remarks that the sequence 9, 99, 999, 9999, 99999, 999999, ... might be called the grumpy German sequence: nein!, nein! nein!, nein! nein! nein!, ...
The Regan link shows that integers of the form 10^n -1 have binary representations with exactly n trailing 1 bits. Also those integers have quinary expressions with exactly n trailing 4's. For example, 10^4 -1 = (304444)5. The first digits in quinary correspond to the number 2^n -1, in our example (30)5 = 2^4 -1. A similar pattern occurs in the binary case. Consider 9 = (1001)2. - Washington Bomfim Dec 23 2010
a(n) is the number of positive integers with less than n+1 digits. - Bui Quang Tuan, Mar 09 2015
From Peter Bala, Sep 27 2015: (Start)
For n >= 1, the simple continued fraction expansion of sqrt(a(2*n)) = [10^n - 1; 1, 2*(10^n - 1), 1, 2*(10^n - 1), ...] has period 2. The simple continued fraction expansion of sqrt(a(2*n))/a(n) = [1; 10^n - 1, 2, 10^n - 1, 2, ...] also has period 2. Note the occurrence of large partial quotients in both expansions.
A theorem of Kuzmin in the measure theory of continued fractions says that large partial quotients are the exception in continued fraction expansions.
Empirically, we also see the presence of unexpectedly large partial quotients early in the continued fraction expansions of the m-th roots of the numbers a(m*n) for m >= 3. Some typical examples are given below. (End)
For n > 0, numbers whose smallest decimal digit is 9. - Stefano Spezia, Nov 16 2023

Examples

			From _Peter Bala_, Sep 27 2015: (Start)
Continued fraction expansions showing large partial quotients:
a(12)^(1/3) = [9999; 1, 299999998, 1, 9998, 1, 449999998, 1, 7998, 1, 535714284, 1, 2, 2, 142, 2, 2, 1, 599999999, 3, 1, 1,...].
Compare with a(30)^(1/3) = [9999999999; 1, 299999999999999999998, 1, 9999999998, 1, 449999999999999999998, 1, 7999999998, 1, 535714285714285714284, 1, 2, 2, 142857142, 2, 2, 1, 599999999999999999999, 3, 1, 1,...].
a(24)^(1/4) = [999999; 1, 3999999999999999998, 1, 666665, 1, 1, 1, 799999999999999999, 3, 476190, 7, 190476190476190476, 21, 43289, 1, 229, 1, 1864801864801863, 1, 4, 6,...].
Compare with a(48)^(1/4) = [999999999999; 1, 3999999999999999999999999999999999998, 1, 666666666665, 1, 1, 1, 799999999999999999999999999999999999, 3, 476190476190, 7, 190476190476190476190476190476190476, 21, 43290043289, 1, 229, 1, 1864801864801864801864801864801863, 1, 4, 6,...].
a(25)^(1/5) = [99999, 1, 499999999999999999998, 1, 49998, 1, 999999999999999999998, 1, 33332, 3, 151515151515151515151, 5, 1, 1, 1947, 1, 1, 38, 3787878787878787878, 1, 3, 5,...].
(End)
		

Crossrefs

Programs

Formula

From Mohammad K. Azarian, Jan 14 2009: (Start)
G.f.: 1/(1-10*x)-1/(1-x).
E.g.f.: e^(10*x)-e^x. (End)
a(n) = A075412(n)/A002275(n) = A178630(n)/A002276(n) = A178631(n)/A002277(n) = A075415(n)/A002278(n) = A178632(n)/A002279(n) = A178633(n)/A002280(n) = A178634(n)/A002281(n) = A178635(n)/A002282(n). - Reinhard Zumkeller, May 31 2010
a(n) = a(n-1) + 9*10^(n-1) with a(0)=0; Also: a(n) = 11*a(n-1) - 10*a(n-2) with a(0)=0, a(1)=9. - Vincenzo Librandi, Jul 22 2010
For n>0, A007953(a(n)) = A008591(n) and A010888(a(n)) = 9. - Reinhard Zumkeller, Aug 06 2010
A048379(a(n)) = 0. - Reinhard Zumkeller, Feb 21 2014
a(n) = Sum_{k=1..n} 9*10^k. - Carauleanu Marc, Sep 03 2016
Sum_{n>=1} 1/a(n) = A073668. - Amiram Eldar, Nov 13 2020
From Elmo R. Oliveira, Jul 19 2025: (Start)
a(n) = 9*A002275(n).
a(n) = A010785(A008591(n)). (End)

Extensions

More terms from Michael De Vlieger, Sep 27 2015

A035327 Write n in binary, interchange 0's and 1's, convert back to decimal.

Original entry on oeis.org

1, 0, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46
Offset: 0

Views

Author

Keywords

Comments

For n>0: largest m<=n such that no carry occurs when adding m to n in binary arithmetic: A003817(n+1) = a(n) + n = a(n) XOR n. - Reinhard Zumkeller, Nov 14 2009
a(0) could be considered to be 0 (it was set so from 2004 to 2008) if the binary representation of zero was chosen to be the empty string. - Jason Kimberley, Sep 19 2011
For n > 0: A240857(n,a(n)) = 0. - Reinhard Zumkeller, Apr 14 2014
This is a base-2 analog of A048379. Another variant, without converting back to decimal, is given in A256078. - M. F. Hasler, Mar 22 2015
For n >= 2, a(n) is the least nonnegative k that must be added to n+1 to make a power of 2. Hence in a single-elimination tennis tournament with n entrants, a(n-1) is the number of players given a bye in round one, so that the number of players remaining at the start of round two is a power of 2. For example, if 39 players register, a(38)=25 players receive a round-one bye leaving 14 to play, so that round two will have 25+(14/2)=32 players. - Mathew Englander, Jan 20 2024

Examples

			8 = 1000 -> 0111 = 111 = 7.
		

Crossrefs

a(n) = A003817(n) - n, for n>0.
Cf. A240857.

Programs

  • Haskell
    a035327 n = if n <= 1 then 1 - n else 2 * a035327 n' + 1 - b
                where (n',b) = divMod n 2
    -- Reinhard Zumkeller, Feb 21 2014
    
  • Julia
    using IntegerSequences
    A035327List(len) = [Bits("NAND", n, n) for n in 0:len]
    println(A035327List(100))  # Peter Luschny, Sep 25 2021
  • Magma
    A035327:=func; // Jason Kimberley, Sep 19 2011
    
  • Maple
    seq(2^(1 + ilog2(max(n, 1))) - 1 - n, n = 0..81); # Emeric Deutsch, Oct 19 2008
    A035327 := n -> `if`(n=0, 1, Bits:-Nand(n, n)):
    seq(A035327(n), n=0..81); # Peter Luschny, Sep 23 2019
  • Mathematica
    Table[BaseForm[FromDigits[(IntegerDigits[i, 2]/.{0->1, 1->0}), 2], 10], {i, 0, 90}]
    Table[BitXor[n, 2^IntegerPart[Log[2, n] + 1] - 1], {n, 100}] (* Alonso del Arte, Jan 14 2006 *)
    Join[{1},Table[2^BitLength[n]-n-1,{n,100}]] (* Paolo Xausa, Oct 13 2023 *)
    Table[FromDigits[IntegerDigits[n,2]/.{0->1,1->0},2],{n,0,90}] (* Harvey P. Dale, May 03 2025 *)
  • PARI
    a(n)=sum(k=1,n,if(bitxor(n,k)>n,1,0)) \\ Paul D. Hanna, Jan 21 2006
    
  • PARI
    a(n) = bitxor(n, 2^(1+logint(max(n,1), 2))-1) \\ Rémy Sigrist, Jan 04 2019
    
  • PARI
    a(n)=if(n, bitneg(n, exponent(n)+1), 1) \\ Charles R Greathouse IV, Apr 13 2020
    
  • Python
    def a(n): return int(''.join('1' if i == '0' else '0' for i in bin(n)[2:]), 2) # Indranil Ghosh, Apr 29 2017
    
  • Python
    def a(n): return 1 if n == 0 else n^((1 << n.bit_length()) - 1)
    print([a(n) for n in range(100)]) # Michael S. Branicky, Sep 28 2021
    
  • Python
    def A035327(n): return (~n)^(-1<Chai Wah Wu, Dec 20 2022
    
  • SageMath
    def a(n):
        if n == 0:
            return 1
        return sum([(1 - b) << s for (s, b) in enumerate(n.bits())])
    [a(n) for n in srange(82)]  # Peter Luschny, Aug 31 2019
    

Formula

a(n) = 2^k - n - 1, where 2^(k-1) <= n < 2^k.
a(n+1) = (a(n)+n) mod (n+1); a(0) = 1. - Reinhard Zumkeller, Jul 22 2002
G.f.: 1 + 1/(1-x)*Sum_{k>=0} 2^k*x^2^(k+1)/(1+x^2^k). - Ralf Stephan, May 06 2003
a(0) = 0, a(2n+1) = 2*a(n), a(2n) = 2*a(n) + 1. - Philippe Deléham, Feb 29 2004
a(n) = number of positive integers k < n such that n XOR k > n. a(n) = n - A006257(n). - Paul D. Hanna, Jan 21 2006
a(n) = 2^{1+floor(log[2](n))}-n-1 for n>=1; a(0)=1. - Emeric Deutsch, Oct 19 2008
a(n) = if n<2 then 1 - n else 2*a(floor(n/2)) + 1 - n mod 2. - Reinhard Zumkeller, Jan 20 2010
a(n) = abs(2*A053644(n) - n - 1). - Mathew Englander, Jan 22 2024

Extensions

More terms from Vit Planocka (planocka(AT)mistral.cz), Feb 01 2003
a(0) corrected by Paolo P. Lava, Oct 22 2007
Definition completed by M. F. Hasler, Mar 22 2015

A032810 Numbers using only digits 2 and 3.

Original entry on oeis.org

2, 3, 22, 23, 32, 33, 222, 223, 232, 233, 322, 323, 332, 333, 2222, 2223, 2232, 2233, 2322, 2323, 2332, 2333, 3222, 3223, 3232, 3233, 3322, 3323, 3332, 3333, 22222, 22223, 22232, 22233, 22322, 22323, 22332, 22333, 23222, 23223
Offset: 1

Views

Author

Keywords

Comments

Identical to A007931 with substitution of digits 2 -> 3, 1 -> 2, i.e., application of the function A048379 or A256079(n) = n + A002275(A055642(n)). - M. F. Hasler, Mar 21 2015

Crossrefs

Cf. A020458, A143967, A248907 (permutation).
Cf. A032804-A032816 (in other bases), A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9).

Programs

  • Haskell
    a032810 = f 0 . (+ 1) where
       f y 1 = a004086 y
       f y x = f (10 * y + m + 2) x' where (x', m) = divMod x 2
    -- Reinhard Zumkeller, Mar 18 2015
    
  • Magma
    [n: n in [1..24000] | Set(Intseq(n)) subset {2, 3}]; // Vincenzo Librandi, May 27 2012
    
  • Magma
    [n eq 1 select 2 else IsOdd(n) select 10*Self(Floor(n/2))+2 else Self(n-1)+1: n in [1..40]]; // Bruno Berselli, May 27 2012
    
  • Mathematica
    Flatten[Table[FromDigits[#,10]&/@Tuples[{2,3},n],{n,5}]] (* Vincenzo Librandi, May 27 2012 *)
  • PARI
    A032810(n)=vector(#n=binary(n+1)[2..-1],i,10^(#n-i))*n~+10^#n\9*2 \\ M. F. Hasler, Mar 26 2015
    
  • Python
    def A032810(n): return int(bin(n+1)[3:])+(10**((n+1).bit_length()-1)-1<<1)//9 # Chai Wah Wu, Jul 15 2023

Formula

a(n) = f(n+1, 0) with f(n, x) = if n=1 then A004086(x) else f(floor(n/2), 10*x + 2 + n mod 2). - Reinhard Zumkeller, Sep 06 2008
a(n) is Theta(n^(log_2 10)); there are about n^(log_10 2) members of this sequence up to n. - Charles R Greathouse IV, Mar 18 2010
a(n) = A007931(n) + A002275(A000523(n+1)). A055642(a(n)) = A000523(n+1). - M. F. Hasler, Mar 21 2015

A061844 Squares that remain squares if you decrease every digit by 1.

Original entry on oeis.org

1, 36, 3136, 24336, 5973136, 71526293136, 318723477136, 264779654424693136, 24987377153764853136, 31872399155963477136, 58396845218255516736, 517177921565478376336, 252815272791521979771662766736, 518364744896318875336864648336, 554692513628187865132829886736
Offset: 1

Views

Author

Erich Friedman, Jun 23 2001

Keywords

Comments

The terms may be calculated efficiently by solving x^2 - y^2 = 111...1; this is done by factoring 111..1 = (x + y)(x - y).
Note that some solutions will produce a square containing a zero digit so the solution is impermissible; for example, 460^2 - 317^2 = 111111 but 460^2 = 211600. - Wendy Appleby, Sep 20 2015
Except for a(1) = 1, we don't allow decreasing the digits to create a leading 0. Thus 126736 = 356^2 is not included, even though 126736 - 111111 = 15625 = 125^2. - Robert Israel, Dec 30 2015
If it exists, a(79) > 10^262. - Max Alekseyev, Sep 05 2023
From Robert Israel, Jan 04 2016: (Start)
The sequence may well be finite.
It is known that A000005(n) = O(n^epsilon) for all epsilon>0.
Therefore if 1 < c < 10/9, for d sufficiently large (10^d-1)/9 has fewer than c^d divisors, and thus fewer than c^d possible candidates for x^2 having d digits.
Heuristically, x^2 has probability ~ (9/10)^d of having no digits 0.
Thus we expect fewer than (9c/10)^d terms having d digits.
Since Sum_d (9c/10)^d converges, we expect only finitely many terms.
Of course, this is only a heuristic argument, but it seems to fit well with the data. (End)

Examples

			13225 = 115^2 and 24336 = 156^2.
		

Crossrefs

Programs

  • Maple
    A:= {1}:
    for d from 1 to 96 do
      r:= (10^d-1)/9;
      f:= subs(X=10,factors((X^d-1)/(X-1))[2]);
      q:= map(t -> op(map(s -> [s[1],t[2]*s[2]], ifactors(t[1])[2])),f);
      divs:= {1};
    for t in q do
        divs:= map(x -> seq(x*t[1]^j,j=0..t[2]),divs)
      od;
      for t in select(s -> s^2 > r, divs) do
        x:= (t + r/t)/2;
        if ilog10(x^2) = d-1 and x^2 > 2*10^(d-1) and not has(convert(x^2,base,10),0) then
          A:= A union {x^2};
        fi
      od
    od:
    sort(convert(A,list)); # Robert Israel, Dec 30 2015
  • Mathematica
    For[digits = 1, digits <= 30, digits++, n = (10^digits - 1)/9; divList = Select[Divisors[n], (#1 >= Sqrt[n])&]; For[j = 1, j <= Length[divList], j++, x = (divList[[j]] + n/divList[[j]])/2; y = (divList[[j]] - n/divList[[j]])/2; dx = IntegerDigits[x^2]; dy = IntegerDigits[y^2]; If[(Length[dx] == digits) && (Length[dy] == digits) && (Select[dx, (#1 == 0)&] == {}), Print[x^2]]]]
    Flatten@Prepend[Table[Select[#[[Ceiling[(Length[#] + 1)/2] ;;]] &@(# + Reverse@#)/2 &@Divisors[(10^n - 1)/9], IntegerLength[#^2] == n && (#[[1]] != 1 && FreeQ[#, 0]&[IntegerDigits[#^2]])&]^2, {n, 30}], 1] (* JungHwan Min, Dec 29 2015 *)
    Join[{1},Select[Select[Flatten[Table[#^2&/@(x/.Solve[{x^2-y^2 == FromDigits[ PadRight[{},n,1]],x>0,y>0},{x,y},Integers]),{n,2,30}]], DigitCount[ #,10,0]==0&&IntegerDigits[#][[1]]>1&]// Union,IntegerQ[ Sqrt[ FromDigits[IntegerDigits[#]-1]]]&]] (* Harvey P. Dale, Apr 16 2016 *)

Formula

a(n) = A048379(A061843(n)). - Max Alekseyev, Jul 26 2023

Extensions

More terms and program from Jonathan Cross (jcross(AT)wcox.com), Oct 08 2001

A117755 Squares which remain squares when each digit is replaced by the next digit.

Original entry on oeis.org

0, 9, 25, 2025, 13225, 1974025, 4862025, 6943225, 60415182025, 207612366025, 916408817340025, 9960302475729225, 153668543313582025, 1978088677245614025, 13876266042653742025, 20761288044852366025, 47285734107144405625, 406066810454367265225
Offset: 1

Views

Author

Luc Stevens (lms022(AT)yahoo.com), Apr 14 2006

Keywords

Comments

Replace 1 with 2, 2 with 3, ..., 8 with 9 and 9 with 0.

Examples

			13225 is in the sequence because (1) it is a square and (2) if we transform it we get 24336 and this is also a square.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 500000]^2, IntegerQ[Sqrt[FromDigits[(1 + IntegerDigits[ # ]) /. 10-> 0]]] &] (* Harvey P. Dale, Jan 21 2007 *)

Extensions

More terms from Harvey P. Dale, Jan 21 2007
3 more terms from Donovan Johnson, Apr 03 2008
a(14)-a(21) from Max Alekseyev, Oct 22 2008
a(1) = 0 prepended by Max Alekseyev, Jul 26 2023

A256078 Write n in binary, exchange digits '0' <-> '1'.

Original entry on oeis.org

1, 0, 1, 0, 11, 10, 1, 0, 111, 110, 101, 100, 11, 10, 1, 0, 1111, 1110, 1101, 1100, 1011, 1010, 1001, 1000, 111, 110, 101, 100, 11, 10, 1, 0, 11111, 11110, 11101, 11100, 11011, 11010, 11001, 11000, 10111, 10110, 10101, 10100, 10011, 10010, 10001, 10000
Offset: 0

Views

Author

M. F. Hasler, Mar 22 2015

Keywords

Comments

Binary representation of A035327.
A base-2 analog of A048379.

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,i;
      L:= convert(n,base,2);
      add((1-L[i])*10^(i-1),i=1..nops(L))
    end proc:
    map(f, [$0..100]); # Robert Israel, Sep 17 2024
  • Mathematica
    Table[FromDigits[IntegerDigits[n, 2] /. {0 -> 1, 1 -> 0}], {n, 0, 47}] (* or *)
    Table[FromDigits@ IntegerDigits[BitXor[n, 2^IntegerPart[Log[2, n] + 1] - 1], 2], {n, 0, 47}] (* Michael De Vlieger, Mar 22 2015, the latter based on Alonso del Arte at A035327 *)
  • PARI
    A256078(n)=!n+eval(Strchr(apply(d->49-d,binary(n))))
    
  • Python
    def a(n): return int(bin(1 if n==0 else n^((1 << n.bit_length())-1))[2:])
    print([a(n) for n in range(48)]) # Michael S. Branicky, Dec 21 2022

A169918 Squares in carryless arithmetic mod 10 with addition of digits defined to be multiplication mod 10 and multiplication of digits defined to be addition mod 10.

Original entry on oeis.org

0, 2, 4, 6, 8, 0, 2, 4, 6, 8, 210, 242, 294, 266, 258, 260, 292, 244, 216, 208, 440, 492, 464, 456, 468, 490, 442, 414, 406, 418, 690, 662, 654, 666, 698, 640, 612, 604, 616, 648, 860, 852, 864, 896, 848, 810, 802, 814, 846, 898, 50, 62, 94, 46, 18, 0, 12, 44, 96, 68, 260, 292
Offset: 0

Views

Author

Keywords

Comments

The rules of arithmetic used in A169916, A169917, A169918 have very strange consequences. Many of the familiar laws fail. For instance, the arithmetic in A169916 is not associative: 10*(9*2) = 10*1 = 21 != (10*9)*2 = 9*2 = 1.

Examples

			a(17) = 17*17 = 244:
...17
...17
-----
...84 (7*7 = 7+7 mod 10 = 4, 7*1 = 7+1 mod 10 = 8)
..28.
-----
..244
(The rule for "adding" the columns is to multiply mod 10: 8+8 = 8 * 8 mod 10 = 4. Blanks are ignored)
		

Crossrefs

See A048379, A169931-A169933, A169935 for other examples of calculations in this version of arithmetic.
The four versions are A059729, A169916, A169917, A169918.

Programs

  • PARI
    A169918(n)={u=vector(#n=digits(n),i,1);n=apply(d->n+d*u,n)%10;sum(i=0,2*#n-2,prod(j=max(1,#n-i),min(2*#n-1-i,#n),n[2*#n-i-j][j])%10*10^i)} \\ M. F. Hasler, Mar 26 2015

Extensions

Thanks to Rick L. Shepherd for pointing out a typo in the example. - N. J. A. Sloane, Nov 08 2014

A256289 Apply the transformation 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 0 to the digits of n written in base 9; do not convert back to base 10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 0, 21, 22, 23, 24, 25, 26, 27, 28, 20, 31, 32, 33, 34, 35, 36, 37, 38, 30, 41, 42, 43, 44, 45, 46, 47, 48, 40, 51, 52, 53, 54, 55, 56, 57, 58, 50, 61, 62, 63, 64, 65, 66, 67, 68, 60, 71, 72, 73, 74, 75, 76
Offset: 0

Views

Author

M. F. Hasler, Mar 22 2015

Keywords

Comments

Base 9 variant of A256078 (base 2) and A048379 (base 10). See A256303 - A256308 for bases 3 through 8, and A256299 for the variant where the result is converted back to base 10.

Examples

			a(9) = 21 because 9 = "10" in base 9 becomes "21".
a(80) = 0 because 80 = "88" in base 9 becomes "00".
		

Programs

  • PARI
    A256289(n,b=9)=!n+eval(Strchr(apply(d->(d+1)%b+48, digits(n,b))))

A256293 Apply the transformation 0 -> 1 -> 2 -> 0 to the digits of n written in base 3, then convert back to base 10.

Original entry on oeis.org

1, 2, 0, 7, 8, 6, 1, 2, 0, 22, 23, 21, 25, 26, 24, 19, 20, 18, 4, 5, 3, 7, 8, 6, 1, 2, 0, 67, 68, 66, 70, 71, 69, 64, 65, 63, 76, 77, 75, 79, 80, 78, 73, 74, 72, 58, 59, 57, 61, 62, 60, 55, 56, 54, 13, 14, 12, 16, 17, 15
Offset: 0

Views

Author

M. F. Hasler, Mar 22 2015

Keywords

Comments

Base 3 variant of A035327 (base 2) and A048379 (base 10).
See A256294 - A256299 for bases 4 through 9, and A256303 for the variant where the result is not converted back to base 10.

Examples

			a(3) = 7 because 3 = 10[3] becomes 21[3] = 7.
a(8) = 0 because 8 = 22[3] becomes 00[3] = 0.
		

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[n,3]/.{0->1,1->2,2->0},3],{n,0,100}] (* Harvey P. Dale, Jan 21 2019 *)
  • PARI
    A256293(n,b=3)=!n+apply(t->(t+1)%b,n=digits(n,b))*vector(#n,i,b^(#n-i))~
Showing 1-10 of 25 results. Next