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-6 of 6 results.

A008585 a(n) = 3*n.

Original entry on oeis.org

0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177
Offset: 0

Views

Author

Keywords

Comments

If n != 1 and n^2+2 is prime then n is a member of this sequence. - Cino Hilliard, Mar 19 2007
Multiples of 3. Positive members of this sequence are the third transversal numbers (or 3-transversal numbers): Numbers of the 3rd column of positive numbers in the square array of nonnegative and polygonal numbers A139600. Also, numbers of the 3rd column in the square array A057145. - Omar E. Pol, May 02 2008
Numbers n for which polynomial 27*x^6-2^n is factorizable. - Artur Jasinski, Nov 01 2008
1/7 in base-2 notation = 0.001001001... = 1/2^3 + 1/2^6 + 1/2^9 + ... - Gary W. Adamson, Jan 24 2009
A165330(a(n)) = 153 for n > 0; subsequence of A031179. - Reinhard Zumkeller, Sep 17 2009
A011655(a(n)) = 0. - Reinhard Zumkeller, Nov 30 2009
A215879(a(n)) = 0. - Reinhard Zumkeller, Dec 28 2012
Moser conjectured, and Newman proved, that the terms of this sequence are more likely to have an even number of 1s in binary than an odd number. The excess is an undulating multiple of n^(log 3/log 4). See also Coquet, who refines this result. - Charles R Greathouse IV, Jul 17 2013
Integer areas of medial triangles of integer-sided triangles.
Also integer subset of A188158(n)/4.
A medial triangle MNO is formed by joining the midpoints of the sides of a triangle ABC. The area of a medial triangle is A/4 where A is the area of the initial triangle ABC. - Michel Lagneau, Oct 28 2013
From Derek Orr, Nov 22 2014: (Start)
Let b(0) = 0, and b(n) = the number of distinct terms in the set of pairwise sums {b(0), ... b(n-1)} + {b(0), ... b(n-1)}. Then b(n+1) = a(n), for n > 0.
Example: b(1) = the number of distinct sums of {0} + {0}. The only possible sum is {0} so b(1) = 1. b(2) = the number of distinct sums of {0,1} + {0,1}. The possible sums are {0,1,2} so b(2) = 3. b(3) = the number of distinct sums of {0,1,3} + {0,1,3}. The possible sums are {0, 1, 2, 3, 4, 6} so b(3) = 6. This continues and one can see that b(n+1) = a(n). (End)
Number of partitions of 6n into exactly 2 parts. - Colin Barker, Mar 23 2015
Partial sums are in A045943. - Guenther Schrack, May 18 2017
Number of edges in a maximal planar graph with n+2 vertices, n > 0 (see A008486 comments). - Jonathan Sondow, Mar 03 2018
Also numbers such that when the leftmost digit is moved to the unit's place the result is divisible by 3. - Stefano Spezia, Jul 08 2025

Examples

			G.f.: 3*x + 6*x^2 + 9*x^3 + 12*x^4 + 15*x^5 + 18*x^6 + 21*x^7 + ...
		

References

  • A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 189.

Crossrefs

Row / column 3 of A004247 and of A325820.
Cf. A016957, A057145, A139600, A139606, A001651 (complement), A032031 (partial products), A190944 (binary), A061819 (base 4).

Programs

Formula

G.f.: 3*x/(1-x)^2. - R. J. Mathar, Oct 23 2008
a(n) = A008486(n), n > 0. - R. J. Mathar, Oct 28 2008
G.f.: A(x) - 1, where A(x) is the g.f. of A008486. - Gennady Eremin, Feb 20 2021
a(n) = Sum_{k=0..inf} A030308(n,k)*A007283(k). - Philippe Deléham, Oct 17 2011
E.g.f.: 3*x*exp(x). - Ilya Gutkovskiy, May 18 2016
From Guenther Schrack, May 18 2017: (Start)
a(3*k) = a(a(k)) = A008591(n).
a(3*k+1) = a(a(k) + 1) = a(A016777(n)) = A017197(n).
a(3*k+2) = a(a(k) + 2) = a(A016789(n)) = A017233(n). (End)

Extensions

Partially edited by Joerg Arndt, Mar 11 2010

A001651 Numbers not divisible by 3.

Original entry on oeis.org

1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41, 43, 44, 46, 47, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 64, 65, 67, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 100, 101, 103, 104
Offset: 1

Views

Author

Keywords

Comments

Inverse binomial transform of A084858. - Benoit Cloitre, Jun 12 2003
Earliest monotonic sequence starting with (1,2) and satisfying the condition: "a(n)+a(n-1) is not in the sequence." - Benoit Cloitre, Mar 25 2004. [The numbers of the form a(n)+a(n-1) form precisely the complement with respect to the positive integers. - David W. Wilson, Feb 18 2012]
a(1) = 1; a(n) is least number which is relatively prime to the sum of all the previous terms. - Amarnath Murthy, Jun 18 2001
For n > 3, numbers having 3 as an anti-divisor. - Alexandre Wajnberg, Oct 02 2005
Also numbers n such that (n+1)*(n+2)/6 = A000292(n)/n is an integer. - Ctibor O. Zizka, Oct 15 2010
Notice the property described by Gary Detlefs in A113801: more generally, these numbers are of the form (2*h*n + (h-4)*(-1)^n-h)/4 (h, n natural numbers), therefore ((2*h*n + (h-4)*(-1)^n - h)/4)^2 - 1 == 0 (mod h); in this case, a(n)^2 - 1 == 0 (mod 3). - Bruno Berselli, Nov 17 2010
A001651 mod 9 gives A141425. - Paul Curtz, Dec 31 2010. (Correct for the modified offset 1. - M. F. Hasler, Apr 07 2015)
The set of natural numbers (1, 2, 3, ...), sequence A000027; represents the numbers of ordered compositions of n using terms in the signed set: (1, 2, -4, -5, 7, 8, -10, -11, 13, 14, ...). This follows from (1, 2, 3, ...) being the INVERT transform of A011655, signed and beginning: (1, 1, 0, -1, -1, 0, 1, 1, 0, ...). - Gary W. Adamson, Apr 28 2013
Union of A047239 and A047257. - Wesley Ivan Hurt, Dec 19 2013
Numbers whose sum of digits (and digital root) is != 0 (mod 3). - Joerg Arndt, Aug 29 2014
The number of partitions of 3*(n-1) into at most 2 parts. - Colin Barker, Apr 22 2015
a(n) is the number of partitions of 3*n into two distinct parts. - L. Edson Jeffery, Jan 14 2017
Conjectured (and like even easily proved) to be the graph bandwidth of the complete bipartite graph K_{n,n}. - Eric W. Weisstein, Apr 24 2017
Numbers k such that Fibonacci(k) mod 4 = 1 or 3. Equivalently, sequence lists the indices of the odd Fibonacci numbers (see A014437). - Bruno Berselli, Oct 17 2017
Minimum value of n_3 such that the "rectangular spiral pattern" is the optimal solution for Ripà's n_1 X n_2 x n_3 Dots Problem, for any n_1 = n_2. For example, if n_1 = n_2 = 5, n_3 = floor((3/2)*(n_1 - 1)) + 1 = a(5). - Marco Ripà, Jul 23 2018
For n >= 54, a(n) = sat(n, P_n), the minimum number of edges in a P_n-saturated graph on n vertices, where P_n is the n-vertex path (see Dudek, Katona, and Wojda, 2003; Frick and Singleton, 2005). - Danny Rorabaugh, Nov 07 2017
From Roger Ford, May 09 2021: (Start)
a(n) is the smallest sum of arch lengths for the top arches of a semi-meander with n arches. An arch length is the number of arches covered + 1.
/\ The top arch has a length of 3. /\ The top arch has a length of 3.
/ \ Both bottom arches have a //\\ The middle arch has a length of 2.
//\/\\ length of 1. ///\\\ The bottom arch has a length of 1.
Example: a(6) = 8 /\ /\
//\\ /\ //\\ /\ 2 + 1 + 1 + 2 + 1 + 1 = 8. (End)
This is the lexicographically earliest increasing sequence of positive integers such that no polynomial of degree d can be fitted to d+2 consecutive terms (equivalently, such that no iterated difference is zero). - Pontus von Brömssen, Dec 26 2021

Examples

			G.f.: x + 2*x^2 + 4*x^3 + 5*x^4 + 7*x^5 + 8*x^6 + 10*x^7 + 11*x^8 + 13*x^9 + ...
		

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • GAP
    Filtered([0..110],n->n mod 3<>0); # Muniru A Asiru, Jul 24 2018
    
  • Haskell
    a001651 = (`div` 2) . (subtract 1) . (* 3)
    a001651_list = filter ((/= 0) . (`mod` 3)) [1..]
    -- Reinhard Zumkeller, Jul 07 2012, Aug 23 2011
    
  • Magma
    [3*(2*n-1)/4-(-1)^n/4: n in [1..80]]; // Vincenzo Librandi, Jun 07 2011
    
  • Maple
    A001651 := n -> 3*floor(n/2) - (-1)^n; # Corrected by M. F. Hasler, Apr 07 2015
    A001651:=(1+z+z**2)/(z+1)/(z-1)**2; # Simon Plouffe in his 1992 dissertation
    a[1]:=1:a[2]:=2:for n from 3 to 100 do a[n]:=a[n-2]+3 od: seq(a[n], n=1..69); # Zerinvary Lajos, Mar 16 2008, offset corrected by M. F. Hasler, Apr 07 2015
  • Mathematica
    Select[Table[n,{n,200}],Mod[#,3]!=0&] (* Vladimir Joseph Stephan Orlovsky, Feb 18 2011 *)
    Drop[Range[200 + 1], {1, -1, 3}] - 1 (* József Konczer, May 24 2016 *)
    Floor[(3 Range[70] - 1)/2] (* Eric W. Weisstein, Apr 24 2017 *)
    CoefficientList[Series[(x^2 + x + 1)/((x - 1)^2 (x + 1)), {x, 0, 70}],
      x] (* or *)
    LinearRecurrence[{1, 1, -1}, {1, 2, 4}, 70] (* Robert G. Wilson v, Jul 25 2018 *)
  • PARI
    {a(n) = n + (n-1)\2}; /* Michael Somos, Jan 15 2011 */
    
  • PARI
    x='x+O('x^100); Vec(x*(1+x+x^2)/((1-x)*(1-x^2))) \\ Altug Alkan, Oct 22 2015
    
  • Python
    print([k for k in range(1, 105) if k%3]) # Michael S. Branicky, Sep 06 2021
    
  • Python
    def A001651(n): return (n<<1)-(n>>1)-1 # Chai Wah Wu, Mar 05 2024

Formula

a(n) = 3 + a(n-2) for n > 2.
a(n) = a(n-1) + a(n-2) - a(n-3) for n > 3.
a(2*n+1) = 3*n+1, a(2*n) = 3*n-1.
G.f.: x * (1 + x + x^2) / ((1 - x) * (1 - x^2)). - Michael Somos, Jun 08 2000
a(n) = (4-n)*a(n-1) + 2*a(n-2) + (n-3)*a(n-3) (from the Carlitz et al. article).
a(n) = floor((3*n-1)/2). [Corrected by Gary Detlefs]
a(1) = 1, a(n) = 2*a(n-1) - 3*floor(a(n-1)/3). - Benoit Cloitre, Aug 17 2002
a(n+1) = 1 + n - n mod 2 + (n + n mod 2)/2. - Reinhard Zumkeller, Dec 17 2002
a(1) = 1, a(n+1) = a(n) + (a(n) mod 3). - Reinhard Zumkeller, Mar 23 2003
a(1) = 1, a(n) = 3*(n-1) - a(n-1). - Benoit Cloitre, Apr 12 2003
a(n) = 3*(2*n-1)/4 - (-1)^n/4. - Benoit Cloitre, Jun 12 2003
Nearest integer to (Sum_{k>=n} 1/k^3)/(Sum_{k>=n} 1/k^4). - Benoit Cloitre, Jun 12 2003
Partial sums of A040001. a(n) = A032766(n-1)+1. - Paul Barry, Sep 02 2003
a(n) = T(n, 1) = T(n, n-1), where T is the array in A026386. - Emeric Deutsch, Feb 18 2004
a(n) = sqrt(3*A001082(n)+1). - Zak Seidov, Dec 12 2007
a(n) = A077043(n) - A077043(n-1). - Reinhard Zumkeller, Dec 28 2007
a(n) = A001477(n-1) + A008619(n-1). - Yosu Yurramendi, Aug 10 2008
Euler transform of length 3 sequence [2, 1, -1]. - Michael Somos, Sep 06 2008
A011655(a(n)) = 1. - Reinhard Zumkeller, Nov 30 2009
a(n) = n - 1 + ceiling(n/2). - Michael Somos, Jan 15 2011
a(n) = 3*A000217(n)+1 - 2*Sum_{i=1..n-1} a(i), for n>1. - Bruno Berselli, Nov 17 2010
a(n) = 3*floor(n/2) + (-1)^(n+1). - Gary Detlefs, Dec 29 2011
A215879(a(n)) > 0. - Reinhard Zumkeller, Dec 28 2012 [More precisely, A215879 is the characteristic function of A001651. - M. F. Hasler, Apr 07 2015]
a(n) = 2n - 1 - floor(n/2). - Wesley Ivan Hurt, Oct 25 2013
a(n) = (3n - 2 + (n mod 2)) / 2. - Wesley Ivan Hurt, Mar 31 2014
a(n) = A000217(n) - A000982(n-1). - Bui Quang Tuan, Mar 28 2015
1/1^3 - 1/2^3 + 1/4^3 - 1/5^3 + 1/7^3 - 1/8^3 + ... = 4 Pi^3/(3 sqrt(3)). - M. F. Hasler, Mar 29 2015
E.g.f.: (4 + sinh(x) - cosh(x) + 3*(2*x - 1)*exp(x))/4. - Ilya Gutkovskiy, May 24 2016
a(n) = a(n+k-1) + a(n-k) - a(n-1) for n > k >= 0. - Bob Selcoe, Feb 03 2017
a(n) = -a(1-n) for all n in Z. - Michael Somos, Jul 31 2018
a(n) = n + A004526(n-1). - David James Sycamore, Sep 06 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/(3*sqrt(3)) (A073010). - Amiram Eldar, Dec 04 2021
From Amiram Eldar, Nov 22 2024: (Start)
Product_{n>=1} (1 - (-1)^n/a(n)) = 1.
Product_{n>=2} (1 + (-1)^n/a(n)) = 2*Pi/(3*sqrt(3)) (A248897). (End)

Extensions

This is a list, so the offset should be 1. I corrected this and adjusted some of the comments and formulas. Other lines probably also need to be adjusted. - N. J. A. Sloane, Jan 01 2011
Offset of pre-2011 formulas verified or corrected by M. F. Hasler, Apr 07-18 2015 and by Danny Rorabaugh, Oct 23 2015

A215887 Written in decimal, n ends in a(n) consecutive nonzero digits.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0
Offset: 0

Views

Author

M. F. Hasler, Aug 25 2012

Keywords

Comments

Sequences A215879, A215883 and A215884 are the base 3, 4 and 5 analogs, while the base 2 analog of this sequence coincides (up to a shift in the index) with the 2-adic valuation A007814, see comments there.
Starting indexing with k=0 for the rightmost digit, a(n) gives the index of the least significant zero in the decimal representation of n. This may also be the index of the leading zero if there are no zeros in the number itself (A052382). - Antti Karttunen, Dec 07 2017
First occurrence of k is A002275(k). - Robert G. Wilson v, Dec 07 2017

Examples

			Numbers which are multiples of 10 have no nonzero digit at their (right) end, thus a(10*k) = 0.
If numbers are congruent to 1,...,9 mod 100, then they end in a nonzero digit, but do not have more than 1 concatenated nonzero digits at their right end: Thus, a(100k+m)=1 for 0 < m < 10.
In the same way, a(k*10^(e+1)+m) = e if 10^e > m > 10^(e-1).
		

Crossrefs

Cf. A002275, A052382, A339012 (factorial base).

Programs

  • Mathematica
    Table[Which[Divisible[n,10],0,FreeQ[IntegerDigits[n],0], IntegerLength[ n], True, Position[ Reverse[ IntegerDigits[n]],0]-1],{n,0,110}] // Flatten (* Harvey P. Dale, Sep 05 2017 *)
    f[n_] := Block[{c = 0, m = n}, While[Mod[m, 10] > 0, m = Floor[m/10]; c++]; c]; Array[f, 105, 0] (* Robert G. Wilson v, Dec 07 2017 *)
  • PARI
    a(n,b=10)= n=divrem(n,b); for(c=0,9e9, n[2] || return(c); n=divrem(n[1],b))
    
  • PARI
    a(n)=my(k);while(n%10, n\=10; k++); k \\ Charles R Greathouse IV, Sep 26 2013

Extensions

More terms from Antti Karttunen, Dec 07 2017

A215884 Written in base 5, n ends in a(n) consecutive nonzero digits.

Original entry on oeis.org

0, 1, 1, 1, 1, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 1, 1, 1, 1, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0, 3
Offset: 0

Views

Author

M. F. Hasler, Aug 25 2012

Keywords

Comments

Sequences A215879, A215883 and A215887 are the base 3, 4 and 10 analogs, while the base 2 analog of this sequence coincides (up to a shift in the index) with the 2-adic valuation A007814, cf. comments there.

Examples

			The numbers 24,...,31 are written in base 5 as 44,100,101,102,103,104,110,111 and thus end in a string of a(24..31)=2,0,1,1,1,1,0,3 nonzero digits.
		

Programs

  • Mathematica
    cnzd[n_]:=Module[{c=Split[If[#>0,1,0]&/@IntegerDigits[n,5]]},If[FreeQ[ c[[-1]],0],Total[c[[-1]]],0]]; Array[cnzd,120,0] (* Harvey P. Dale, Jan 03 2023 *)
  • PARI
    a(n,b=5)=n=divrem(n,b); for(c=0,9e9,n[2]||return(c); n=divrem(n[1],b))
    
  • PARI
    a(n)=my(k);while(n%5,n\=5;k++);k \\ Charles R Greathouse IV, Sep 26 2013

A322523 a(n) is the least nonnegative integer k for which there does not exist i < j with i+j=n and a(i)=a(j)=k.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 2, 2, 0, 2, 1, 0, 1, 2, 0, 3, 2, 0, 3, 1, 0, 1, 3, 0, 3, 3, 0, 3, 1, 0, 1, 3, 0, 2, 2, 0, 2, 1, 0, 1, 2, 0, 4, 3, 0, 4, 1, 0, 1, 4, 0, 4, 3, 0, 4, 1, 0, 1, 4, 0, 2, 2, 0, 2, 1, 0, 1, 2, 0, 4, 4, 0, 4, 1, 0, 1, 4, 0, 4, 4, 0, 4, 1, 0, 1, 4, 0, 2, 2, 0, 2, 1, 0, 1, 2, 0, 3, 4, 0
Offset: 1

Views

Author

Aidan Clarke, Aug 28 2019

Keywords

Comments

If x is an integer that we are checking whether it is an option for a(n), at position n = 3(3^(x+1)-1)/2 there appears to begin a repeating sequence (containing 3^(x+1) terms) of whether it can or cannot be used for a(n) that continues infinitely.
The variant where we drop the condition "i < j" corresponds to A007814. - Rémy Sigrist, Sep 06 2019

Examples

			a(1) = 0.
a(2) = 0.
a(3) = 1 (because a(1) and a(2) both equal 0).
a(5) = 1 (because a(1) and a(4) both equal 0).
a(8) = 2 (because a(1) and a(7) equal 0, and a(3) and a(5) equal 1).
		

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do
      forbid:= {seq(A[i],i= select(i -> A[i]=A[n-i],[$1..(n-1)/2]))};
      if forbid = {} then A[n]:= 0 else A[n]:= min({$0..max(forbid)+1} minus forbid) fi;
    od:
    seq(A[i],i=1..100); # Robert Israel, Sep 06 2019
  • PARI
    least(v, n) = {my(found = []); for (i=1, n, if (i >= n-i, break, if (v[i] == v[n-i], found = Set(concat(found, v[i]))));); if (#found == 0, return(0)); my(m = vecmax(found)); for (i=0, m, if (!vecsearch(found, i), return (i))); return (m+1);}
    lista(nn) = {my(v = vector(nn)); for (n=1, nn, v[n] = least(v, n);); v;} \\ Michel Marcus, Sep 07 2019
    
  • PARI
    a(n) = my(v=valuation(n,3)); n=n/3^v; if(n==2 || n%3==1, v, A215879((n-5)/3)+1+v) \\ Jianing Song, Aug 23 2022; see A215879 for its program
    
  • Python
    def A322523(n):
        c, m = 0, n
        while not (a:=divmod(m,3))[1]:
            c += 1
            m = a[0]
        if m==2 or m%3==1: return c
        m = (m+1)//3-2
        while (a:=divmod(m,3))[1]:
            c += 1
            m = a[0]
        return c+1 # Chai Wah Wu, Oct 15 2022

Formula

a(n) = 0 iff n belongs to A033627. - Rémy Sigrist, Sep 06 2019
From Jianing Song, Aug 23 2022: (Start)
Properties of this sequence:
(1) a(n) = a(n/3) + 1 for n == 0 (mod 3).
Proof is based on induction on n. Obviously a(n) != 0. For 1 <= e <= a(n/3), there exists i+j = n/3, i < j such that a(i) = a(j) = e-1, by induction hypothesis we have a(3*i) = a(3*j) = e, so a(n) != e. a(n) = a(n/3) + 1 is OK. Suppose otherwise that n = i+j, i < j and a(i) = a(j) = a(n/3) + 1 > 0, then i,j == 0 (mod 3), by induction hypothesis we have a(i/3) = a(j/3) = a(n/3), a contradiction.
(2) a(n) = A215879((n-5)/3) + 1 for n == 2 (mod 3) and n > 2.
If A215879((n-5)/3) = t, then n = 3*(Sum_{0<=r<=t-1} d_r*3^r + O(3^(t+1))) + 5, d_r = 1 or 2. Suppose that a(m) = A215879((m-5)/3) + 1 for m == 2 (mod 3) and 2 < n < m.
Obviously a(n) != 0. From (1) we know that a(3^e) = a(2*3^e) = t. For 1 <= e <= t, n - d_e*3^e = 3*(Sum_{0<=r<=t-1, r!=e-1} d_r*3^r + O(3^(t+1))) + 5 = 3*(Sum_{0<=r<=e-2} d_r*3^r + O(3^e)) + 5, so A215879((n-d_e*3^e-5)/3) = e-1. Since 5 <= n - d_e*3^e == 2 (mod 3), by induction hypothesis we have a(n-d_e*3^e) = e = a(d_e*3^e), so a(n) != e.
a(n) = t+1 is OK. Suppose otherwise that n = i+j, i != j and a(i) = a(j) = t+1 > 0, then {i,j} == {0,2} (mod 3) and i,j > 2. Suppose that i == 2 (mod 3), by induction hypothesis A215879((i-5)/3) = t. Write i = 3*(Sum_{0<=r<=t-1} d'_r*3^r + O(3^(t+1))) + 5, 1 <= d'_r <= d_r. If d'_r = d_r for all r, then j = n-i is divisible by 3^(t+2), so a(j) >= t+2, a contradiction. If d'_r != d_r for some r, then j = 3^(r_0+1) + O(3^(r_0+2)) where r_0 is the smallest index such that d'_r != d_r, so a(j) = r_0+1 + a(1+O(3^1)) = r_0+1 <= t, also a contradiction.
Recursive formulas:
a(n) = 0 for n = 2 or n == 1 (mod 3);
a(n) = 1 for n == 5 (mod 9);
a(n) = a(n/3) + 1 for n == 0 (mod 3);
a(n) = a((n+4)/3) + 1 for n == 2 (mod 9) and n > 2;
a(n) = a((n+7)/3) + 1 for n == 8 (mod 9).
Let A_1 = {3}, B_1 = {5}, A_{t+1} = {3*n: n in A_t, B_t}, B_{t+1} = {3*n-7, 3*n-4: n in B_t}, then for t >= 1, {n: a(n) = t} = (Union_{k>=0} {n+k*3^(t+1): n in A_t, B_t}) U {2*3^t}.
General formula: write n = s*3^t, gcd(s,3) = 1, then a(n) = t if s = 2 or s == 1 (mod 3), A215879((s-5)/3) + 1 + t otherwise. (End)

A215883 When written in base 4, n ends in a(n) consecutive nonzero digits.

Original entry on oeis.org

0, 1, 1, 1, 0, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 0, 1, 1, 1, 0, 3, 3, 3, 0, 3, 3, 3, 0, 3, 3, 3, 0, 1, 1, 1, 0, 3, 3, 3, 0, 3, 3, 3, 0, 3, 3, 3, 0, 1, 1, 1, 0, 3, 3, 3, 0, 3, 3, 3, 0, 3, 3, 3, 0, 1, 1, 1, 0, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 0, 1, 1, 1, 0, 4, 4
Offset: 0

Views

Author

M. F. Hasler, Aug 25 2012

Keywords

Comments

Sequences A215879, A215884 and A215887 are the base 3, 5 and 10 analog, while the base 2 analog of this sequence coincides (up to a shift in the index) with the 2-adic valuation A007814, see comments there.

Examples

			The numbers 0,1,2,3,4,5,6,7 are written in base 4 as 0,1,2,3,10,11,12,13 and thus end in a(0..7)=0,1,1,1,0,2,2,2 nonzero digits.
		

Programs

  • PARI
    a(n,b=4)=n=divrem(n,b); for(c=0,9e9,n[2]||return(c); n=divrem(n[1],b))
    
  • PARI
    a(n)=my(k);while(n%4,n>>=2;k++);k \\ Charles R Greathouse IV, Sep 26 2013

Formula

a(4^(t+1)*k+m) = t for 4^t > m > 4^(t-1).
Showing 1-6 of 6 results.