login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A261236 a(n) = A261234(n) - A261237(n). 4

%I #16 Jun 29 2016 00:09:15

%S 0,1,3,7,16,40,104,279,758,2071,5678,15609,43035,119139,331616,928572,

%T 2614743,7396880,20999683,59784414,170615755,488073987,1399625614,

%U 4023315793,11590737827,33452982391

%N a(n) = A261234(n) - A261237(n).

%C a(n) = How many numbers whose base-3 representation begins with digit "1" 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).

%F a(n) = A261234(n) - A261237(n).

%e For n=2, we start from 3^(2+1) - 1 = 26 ("222" in base-3), and subtract 6 to get 20 ("202" in base-3), from which we subtract 4, to get 16 ("121" in base-3), from which we subtract 4, to get 12 ("110" in base-3), from which we subtract 2 to get 10 ("101" in base-3), from which we subtract 2 to get 8 ("22" in base-3), which is the end point of iteration. Of the numbers encountered, 16, 12 and 10 have base-3 representations beginning with digit "1", thus a(2) = 3.

%t Table[Length@ # - First@ FirstPosition[#, k_ /; k != 2] &@ 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 *)

%o (C) /* Use the C-program given in A261234. */

%o (Scheme) (define (A261236 n) (- (A261234 n) (A261237 n)))

%Y Cf. A261234, A261237, A261230.

%K nonn,base

%O 0,3

%A _Antti Karttunen_, Aug 16 2015

%E Terms a(24) & a(25) from _Antti Karttunen_, Jun 27 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 17 12:21 EDT 2024. Contains 375210 sequences. (Running on oeis4.)