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

A261230 a(n) = A261236(n) - A261237(n).

Original entry on oeis.org

-1, 0, 1, 2, 3, 6, 12, 28, 71, 186, 494, 1317, 3478, 9045, 23265, 59856, 155779, 412413, 1108874, 3009228, 8188150, 22257484, 60462422, 164715758, 452011067, 1253176571
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Length@ # - 2 First@ FirstPosition[#, k_ /; k != 2] + 1 &@ Map[First@ IntegerDigits[#, 3] &, #] &@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &], {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
  • Scheme
    (define (A261230 n) (- (A261236 n) (A261237 n)))

Formula

a(n) = A261236(n) - A261237(n).

Extensions

Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016

A261234 a(n) = number of steps to reach (3^n)-1 when starting from k = (3^(n+1))-1 and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k).

Original entry on oeis.org

1, 2, 5, 12, 29, 74, 196, 530, 1445, 3956, 10862, 29901, 82592, 229233, 639967, 1797288, 5073707, 14381347, 40890492, 116559600, 333043360, 953890490, 2738788806, 7881915828, 22729464587, 65652788211, 189866467219, 549596773550, 1592118137130, 4615680732717, 13392399641613, 38894563977633, 113074467549440, 329080350818600, 958725278344368, 2795854777347489
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2015

Keywords

Crossrefs

First differences of A261232 and A261233.
Sum of A261236 and A261237.
Cf. A261235 (first differences of this sequence).
Cf. also A213709.

Programs

  • Mathematica
    Table[Length@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &] - 1, {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016 *)

Formula

a(n) = A261236(n) + A261237(n).

Extensions

a(23)-a(35) from Hiroaki Yamanouchi, Aug 16 2015

A261237 Number of steps needed when starting from (3^(n+1))-1 and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k) to encounter the first number whose base-3 representation begins with a digit other than 2.

Original entry on oeis.org

1, 1, 2, 5, 13, 34, 92, 251, 687, 1885, 5184, 14292, 39557, 110094, 308351, 868716, 2458964, 6984467, 19890809, 56775186, 162427605, 465816503, 1339163192, 3858600035, 11138726760, 32199805820
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Comments

a(n) = How many numbers whose base-3 representation begins with digit "2" are encountered before (3^n)-1 is reached when starting from k = (3^(n+1))-1 and repeatedly applying the map that replaces k by k - (sum of digits in base-3 representation of k). Note that (3^n)-1 (in base-3: "222...", with digit "2" repeated n times) is not included in the count, although the starting point (3^(n+1))-1 is.

Examples

			For n=0, we start from 3^(0+1) - 1 = 2 (also "2" in base-3), and subtract 2 to get 0, which doesn't begin with 2, thus a(0) = 1.
For n=1, we start from 3^(1+1) - 1 = 8 ("22" in base-3), and subtract 2*2 = 4 to get 4 ("11" in base-3) which doesn't begin with 2, thus a(1) = 1.
For n=2, we start from 3^(2+1) - 1 = 26 ("222" in base-3), and subtract first 6 to get 20 ("202" in base-3), from which we subtract 4, to get 16 ("121" in base-3), so in two steps we have reached the first such number that does not begin with "2" in base-3, thus a(2) = 2.
		

Crossrefs

Programs

  • C
    /* Use the C-program given in A261234. */
    
  • Mathematica
    Flatten@ Table[FirstPosition[#, k_ /; k != 2] &@ Map[First@ IntegerDigits[#, 3] &, NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &]] - 1, {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
  • PARI
    a(n)=my(k=3^(n+1)-1,t=2*3^n,s); while(k>=t, k-=sumdigits(k,3); s++); s \\ Charles R Greathouse IV, Aug 21 2015
  • Scheme
    (definec (A261237 n) (let loop ((k (- (A000244 (+ 1 n)) 1)) (s 0)) (if (< (A122586 k) 2) s (loop (* 2 (A054861 k)) (+ 1 s)))))
    

Extensions

Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016
Showing 1-3 of 3 results.