login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A302748 Half thrice the previous number, rounded down, plus 1, starting with 6. 0
6, 10, 16, 25, 38, 58, 88, 133, 200, 301, 452, 679, 1019, 1529, 2294, 3442, 5164, 7747, 11621, 17432, 26149, 39224, 58837, 88256, 132385, 198578, 297868, 446803, 670205, 1005308, 1507963, 2261945, 3392918, 5089378, 7634068, 11451103, 17176655, 25764983, 38647475, 57971213 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

Legend has it that the ArrayList data structure in Java would normally be initialized with ten array spaces. Then, if the ArrayList foresaw a need for more spaces, it would add more according to this formula: newCapacity = (oldCapacity * 3)/2 + 1; this was part of the ensureCapacity subroutine.

So, for example, when it became clear that the array would need to hold more than ten elements, it would expand the array to sixteen spaces. And once sixteen was not enough, 25, then 38 and so on and so forth.

Now the formula is newCapacity = oldCapacity + floor(oldCapacity/2) (the latter summand is expressed as oldCapacity shifted one bit to the right).

Whatever formula is used, what happens "under the hood" is that the array with oldCapacity number of spaces is moved to an array with newCapacity number of spaces.

This avoids having to constantly copy an entire array to a new location with more spaces just to add one space. The programmer using ArrayList can remain blissfully unaware that any moving is going on at all.

LINKS

Table of n, a(n) for n=0..39.

Chris Ramacciotti, Unveiling the Mystery Behind a Java Abstraction, Treehouse blog, November 10, 2016.

FORMULA

a(0) = 6, a(n) = floor( 3*a(n-1)/2 ) + 1 for n > 0.

MAPLE

A[0]:= 6: for n from 1 to 100 do A[n]:= floor(3*A[n-1]/2)+1 od:

seq(A[i], i=0..100); # Robert Israel, Jun 04 2018

MATHEMATICA

NestList[Floor[3#/2] + 1 &, 6, 50]

PROG

(Java) for (int i = 10; i < Integer.MAX_VALUE/16; i = (3 * i)/2 + 1) { System.out.print(i + ", "); }

CROSSREFS

Sequence in context: A114975 A230276 A079329 * A020741 A274287 A090991

Adjacent sequences:  A302745 A302746 A302747 * A302749 A302750 A302751

KEYWORD

nonn,easy

AUTHOR

Alonso del Arte, Apr 12 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 13 16:22 EDT 2021. Contains 342936 sequences. (Running on oeis4.)