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.

User: Joshua Oliver

Joshua Oliver's wiki page.

Joshua Oliver has authored 9 sequences.

A332025 Sum of the lengths of the longest runs of 0, 1, and 2 in the ternary expression of n.

Original entry on oeis.org

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

Author

Joshua Oliver, Feb 05 2020

Keywords

Comments

All positive integers appear in this sequence. Given some number k, there will always be some ternary number that has k 1's or k 2's.
The number 0 never appears in this sequence, as every number has at least 1 digit.

Examples

			For n = 268, the ternary expansion of 268 is 100221. The length of the run of 0's in the ternary expansion of 268 is 2. The length of the runs of 1's in the ternary expansion of 268 are 1 and 1 respectively. The length of the run of 2's in the ternary expansion of 268 is 2. The sum of 2, 1, and 2 is 5, so a(268) = 5.
   n [ternary n] A330166(n) + A330167(n) + A330168(n) = a(n)
   0 [        0] 1          + 0          + 0          = 1
   1 [        1] 0          + 1          + 0          = 1
   2 [        2] 0          + 0          + 1          = 1
   3 [      1 0] 1          + 1          + 0          = 2
   4 [      1 1] 0          + 2          + 0          = 2
   5 [      1 2] 0          + 1          + 1          = 2
   6 [      2 0] 1          + 0          + 1          = 2
   7 [      2 1] 0          + 1          + 1          = 2
   8 [      2 2] 0          + 0          + 2          = 2
   9 [    1 0 0] 2          + 1          + 0          = 3
  10 [    1 0 1] 1          + 1          + 0          = 2
  11 [    1 0 2] 1          + 1          + 1          = 3
  12 [    1 1 0] 1          + 2          + 0          = 3
  13 [    1 1 1] 0          + 3          + 0          = 3
  14 [    1 1 2] 0          + 2          + 1          = 3
  15 [    1 2 0] 1          + 1          + 1          = 3
  16 [    1 2 1] 0          + 1          + 1          = 2
  17 [    1 2 2] 0          + 1          + 2          = 3
  18 [    2 0 0] 2          + 0          + 1          = 3
  19 [    2 0 1] 1          + 1          + 1          = 3
  20 [    2 0 2] 1          + 0          + 1          = 2
		

Crossrefs

Programs

  • Mathematica
    Table[Sum[Max@FoldList[If[#2==k,#1+1,0]&,0,IntegerDigits[n,3]],{k,0,2}],{n,1,90}]

Formula

a(n) = A330166(n) + A330167(n) + A330168(n).
a(A003462(n)) = a(A024023(n)) = n.

A330168 Length of the longest run of 2's in the ternary expression of n.

Original entry on oeis.org

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

Author

Joshua Oliver, Dec 04 2019

Keywords

Comments

All numbers appear in this sequence. Numbers of the form 3^n-1 (A024023(n)) have n 2's in their ternary expression.
The longest run of zeros possible in this sequence is 2, as the last digit of the ternary expression of the integers cycles between 0, 1, and 2, meaning that at least one of three consecutive numbers has a 2 in its ternary expression.

Examples

			For n = 74, the ternary expression of 74 is 2202. The length of the runs of 2's in the ternary expression of 74 are 2 and 1, respectively. The larger of these two values is 2, so a(74) = 2.
   n [ternary n] a(n)
   0 [        0] 0
   1 [        1] 0
   2 [        2] 1
   3 [      1 0] 0
   4 [      1 1] 0
   5 [      1 2] 1
   6 [      2 0] 1
   7 [      2 1] 1
   8 [      2 2] 2
   9 [    1 0 0] 0
  10 [    1 0 1] 0
  11 [    1 0 2] 1
  12 [    1 1 0] 0
  13 [    1 1 1] 0
  14 [    1 1 2] 1
  15 [    1 2 0] 1
  16 [    1 2 1] 1
  17 [    1 2 2] 2
  18 [    2 0 0] 1
  19 [    2 0 1] 1
  20 [    2 0 2] 1
		

Crossrefs

Equals zero iff n is in A005836.

Programs

  • Mathematica
    Table[Max@FoldList[If[#2==2,#1+1,0]&,0,IntegerDigits[n,3]],{n,0,90}]

Formula

a(A024023(n)) = a(3^n-1) = n.
a(n) = 0 iff n is in A005836.

A330167 Length of the longest run of 1's in the ternary expression of n.

Original entry on oeis.org

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

Author

Joshua Oliver, Dec 04 2019

Keywords

Comments

All numbers appear in this sequence. Numbers of the form (3^n-1)/2 (A003462(n)) have n 1's in their ternary expression.
The longest run of zeros possible in this sequence is 2, as the last digit of the ternary expression of the integers cycles between 0, 1, and 2, meaning that at least one of three consecutive numbers has a 1 in its ternary expression.

Examples

			For n = 43, the ternary expression of 43 is 1121. The length of the runs of 1's in the ternary expression of 43 are 2 and 1, respectively. The larger of these two values is 2, so a(43) = 2.
   n [ternary n] a(n)
   0 [        0] 0
   1 [        1] 1
   2 [        2] 0
   3 [      1 0] 1
   4 [      1 1] 2
   5 [      1 2] 1
   6 [      2 0] 0
   7 [      2 1] 1
   8 [      2 2] 0
   9 [    1 0 0] 1
  10 [    1 0 1] 1
  11 [    1 0 2] 1
  12 [    1 1 0] 2
  13 [    1 1 1] 3
  14 [    1 1 2] 2
  15 [    1 2 0] 1
  16 [    1 2 1] 1
  17 [    1 2 2] 1
  18 [    2 0 0] 0
  19 [    2 0 1] 1
  20 [    2 0 2] 0
		

Crossrefs

Equals zero iff n is in A005823.

Programs

  • Mathematica
    Table[Max@FoldList[If[#2==1,#1+1,0]&,0,IntegerDigits[n,3]],{n,0,90}]
    Table[Max[Length/@Select[Split[IntegerDigits[n,3]],MemberQ[#,1]&]],{n,0,100}]/.(-\[Infinity]->0) (* Harvey P. Dale, Jan 07 2023 *)

Formula

a(A003462(n)) = a((3^n-1)/2) = n.
a(n) = 0 iff n is in A005823.

A330166 Length of the longest run of 0's in the ternary expression of n.

Original entry on oeis.org

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

Author

Joshua Oliver, Dec 04 2019

Keywords

Comments

All numbers appear in this sequence. The n-th power of 3 (A000244(n)) has n 0's in its ternary expression.
The longest run of zeros possible in this sequence is 2, as the last digit of the ternary expression of the integers cycles between 0, 1, and 2, meaning that at least one of three consecutive numbers has a 0 in its ternary expression.

Examples

			For n = 87, the ternary expression of 87 is 10020. The length of the runs of 0's in the ternary expression of 87 are 2 and 1, respectively. The larger of these two values is 2, so a(87) = 2.
   n [ternary n] a(n)
   0 [        0] 1
   1 [        1] 0
   2 [        2] 0
   3 [      1 0] 1
   4 [      1 1] 0
   5 [      1 2] 0
   6 [      2 0] 1
   7 [      2 1] 0
   8 [      2 2] 0
   9 [    1 0 0] 2
  10 [    1 0 1] 1
  11 [    1 0 2] 1
  12 [    1 1 0] 1
  13 [    1 1 1] 0
  14 [    1 1 2] 0
  15 [    1 2 0] 1
  16 [    1 2 1] 0
  17 [    1 2 2] 0
  18 [    2 0 0] 2
  19 [    2 0 1] 1
  20 [    2 0 2] 1
		

Crossrefs

Equals zero iff n is in A032924.

Programs

  • Mathematica
    Table[Max@FoldList[If[#2==0,#1+1,0]&,0,IntegerDigits[n,3]],{n,0,90}]

Formula

a(A000244(n)) = a(3^n) = n.
a(n) = 0 iff n is in A032924.

A330036 The length of the largest run of 0's in the binary expansion of n + the length of the largest run of 1's in the binary expansion of n.

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 3, 3, 4, 3, 2, 3, 4, 3, 4, 4, 5, 4, 3, 4, 3, 2, 3, 4, 5, 4, 3, 3, 5, 4, 5, 5, 6, 5, 4, 5, 3, 3, 4, 5, 4, 3, 2, 3, 4, 3, 4, 5, 6, 5, 4, 4, 4, 3, 3, 4, 6, 5, 4, 4, 6, 5, 6, 6, 7, 6, 5, 6, 4, 4, 5, 6, 4, 3, 3, 4, 4, 4, 5, 6, 5, 4, 3
Offset: 0

Author

Joshua Oliver, Nov 27 2019

Keywords

Comments

All numbers appear in this sequence. The number of 1's in the n-th Mersenne number (A000225) is n and the number of 0's in the n-th Mersenne number is 0. 0+n=n. See formula.

Examples

			   n [binary n ]  A087117(n) + A038374(n) = a(n)
   0 [       0 ]  1          + 0          = 1
   1 [       1 ]  0          + 1          = 1
   2 [     1 0 ]  1          + 1          = 2
   3 [     1 1 ]  0          + 2          = 2
   4 [   1 0 0 ]  2          + 1          = 3
   5 [   1 0 1 ]  1          + 1          = 2
   6 [   1 1 0 ]  1          + 2          = 3
   7 [   1 1 1 ]  0          + 3          = 3
   8 [ 1 0 0 0 ]  3          + 1          = 4
   9 [ 1 0 0 1 ]  2          + 1          = 3
  10 [ 1 0 1 0 ]  1          + 1          = 2
  11 [ 1 0 1 1 ]  1          + 2          = 3
  12 [ 1 1 0 0 ]  2          + 2          = 4
  13 [ 1 1 0 1 ]  1          + 2          = 3
  14 [ 1 1 1 0 ]  1          + 3          = 4
  15 [ 1 1 1 1 ]  0          + 4          = 4
		

Programs

  • Maple
    f:= proc(n) local L;
      L:= convert(n,base,2);
      max(map(nops,[ListTools:-Split(`=`,L,1)]))+max(map(nops,[ListTools:-Split(`=`,L,0)]))
    end proc:
    map(f, [$0..100]); # Robert Israel, Apr 06 2020
  • Mathematica
    Table[Sum[Max[Differences[Position[Flatten@{k,IntegerDigits[n,2],k},k]]],{k,0,1}]-2,{n,0,82}]

Formula

a(n) = A087117(n) + A038374(n).
a(A000225(n)) = n for n > 0.

A329204 Number of integers less than n having at least as many totatives as n.

Original entry on oeis.org

0, 1, 0, 1, 0, 3, 0, 2, 1, 4, 0, 6, 0, 4, 2, 3, 0, 8, 0, 6, 3, 5, 0, 10, 1, 6, 3, 8, 0, 16, 0, 7, 4, 9, 2, 15, 0, 9, 4, 14, 0, 21, 0, 10, 7, 9, 0, 21, 2, 15, 5, 11, 0, 22, 5, 14, 7, 11, 0, 33, 0, 12, 10, 12, 3, 29, 0, 15, 6, 26, 0, 28, 0, 16, 13, 18, 4, 34, 0, 24, 7, 17
Offset: 1

Author

Joshua Oliver, Nov 22 2019

Keywords

Examples

			a(6) = 3, because 6 has 2 totatives and there are 3 integers less than 6 with 2 or more totatives: 3 with 2 totatives, 4 with 2 totatives, and 5 with 4 totatives.
		

Crossrefs

Cf. A000010.

Programs

  • Mathematica
    Table[Length[Select[Range[n-1],EulerPhi[#]>=EulerPhi[n]&]],{n,1,100}]
  • PARI
    a(n) = sum(k=1, n-1, eulerphi(k) >= eulerphi(n)); \\ Michel Marcus, Nov 22 2019
    
  • PARI
    first(n)=my(u=vectorsmall(n),v=vector(n)); forfactored(f=1,n,u[f[1]]=eulerphi(f)); for(i=1,n, v[i]=sum(j=1,i-1,u[j]>=u[i])); v \\ Charles R Greathouse IV, Dec 11 2019

A329725 a(1)=0, a(n) = n - (product of nonzero digits of n) - a(n-1).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 17, 2, 16, 1, 15, 0, 14, -1, 13, -2, 29, -1, 27, -3, 25, -5, 23, -7, 21, -9, 45, -8, 42, -11, 39, -14, 36, -17, 33, -20, 65, -19, 61, -23, 57, -27, 53, -31, 49, -35, 89, -34, 84, -39, 79, -44, 74, -49, 69, -54, 117
Offset: 1

Author

Joshua Oliver, Nov 19 2019

Keywords

Comments

a(10n+1)-a(10n-1)=1 for all positive integer n (conjectured).

Examples

			a(22) = 22 - 2*2 - 2 = 16.
		

Crossrefs

Programs

  • Maple
    R:= ListTools:-PartialSums(map(n -> (-1)^n*(n - convert(subs(0=NULL,convert(n,base,10)),`*`)), [$1..100])):
    seq((-1)^n*R[n],n=1..100); # Robert Israel, Nov 20 2019
  • Mathematica
    Nest[Append[#1, #2 - Last[#1] - Times @@ DeleteCases[IntegerDigits[#2], 0]] & @@ {#, Length@ # + 1} &, {0}, 69] (* Michael De Vlieger, Nov 19 2019 *)
  • PARI
    for (n=1, 70, print1 (v=if (n==1, 0, n - vecprod(select(sign, digits(n))) - v)", ")) \\ Rémy Sigrist, Nov 28 2019

Formula

a(n) = Sum_{k=2..n} (-1)^(n-k)*A063543(k). - Robert Israel, Nov 20 2019

A329934 a(1)=1, a(2)=1, a(n) = (number of times a(n-1) has appeared before) + (number of times a(n-2) has appeared before).

Original entry on oeis.org

1, 1, 4, 3, 2, 2, 4, 4, 6, 4, 5, 5, 4, 7, 6, 3, 4, 8, 7, 3, 5, 6, 6, 8, 6, 7, 8, 6, 9, 7, 5, 8, 8, 10, 6, 8, 13, 7, 6, 13, 10, 4, 9, 9, 6, 12, 10, 4, 11, 9, 5, 9, 10, 9, 10, 11, 7, 8, 13, 10, 9, 13, 11, 7, 10, 14, 8, 9, 16, 9, 10, 17, 9, 11, 14, 6, 12, 12, 6, 14, 14
Offset: 1

Author

Joshua Oliver, Nov 24 2019

Keywords

Comments

Conjecture: This sequence grows logarithmically.

Examples

			a(n)=4 where n=3 because 1 (a(n-1)) has appeared twice before, and 1 (a(n-2)) has appeared twice before as well. 2+2 = 4.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n=0, 0, b(n-1)+x^a(n)) end:
    a:= proc(n) option remember; `if`(n<3, 1, (p->
          coeff(p, x, a(n-1))+coeff(p, x, a(n-2)))(b(n-1)))
        end:
    seq(a(n), n=1..120);  # Alois P. Heinz, Nov 24 2019
  • Mathematica
    A={1,1};For[n=3,n<=81,n++,A=Append[A,Sum[Count[Table[Part[A,i],{i,1,n-1}],Part[A,n-k]],{k,2}]]];A
  • PARI
    o=vector(17); for (n=1, 81, print1 (v=if (n<3, 1, o[pp]+o[p]) ", "); o[v]++; [pp,p]=[p,v]) \\ Rémy Sigrist, Nov 27 2019

A319604 Largest Brady number with n digits.

Original entry on oeis.org

6569, 73857, 818996, 9082813, 62254526, 690413273, 7656800529, 84915219092, 941724210541, 6454673763134, 71583428964617, 793872392373921, 8804179745077748, 97639849588229149, 669233485047004862, 7421913081219006521, 82310277378456076593, 912834964244235849044
Offset: 4

Author

Joshua Oliver, Sep 24 2018

Keywords

Comments

If a(n) = A247698(k), then a(n+1) = A247698(k+4) or a(n+1) = A247698(k+5). - Charles R Greathouse IV, Dec 10 2019

Crossrefs

Programs

  • Mathematica
    b[1] = 2308; b[2] = 4261; b[n_] := b[n] = b[n-1] + b[n-2]; a[n_] := Block[ {k=1}, While[ IntegerLength[b@k] <= n, k++]; b[k-1]]; a /@ Range[4, 21] (* Giovanni Resta, Sep 24 2018 *)