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!)
A340134 a(n+1) = a(n-2*a(n)) + 1, starting with a(1) = a(2) = 0. 1
0, 0, 1, 1, 1, 2, 1, 2, 2, 2, 3, 2, 3, 2, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 4, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 7, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 8, 8, 9, 8, 9, 8, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,6

LINKS

Table of n, a(n) for n=1..87.

FORMULA

a(n) = floor(sqrt(n-1)) + ((-1)^(n+floor(sqrt(n)))-1)/2.

EXAMPLE

a(3) = a(2-2*a(2))+1 = a(2)+1 = 1.

a(4) = a(3-2*a(3))+1 = a(1)+1 = 1.

a(5) = a(4-2*a(4))+1 = a(2)+1 = 1.

a(6) = a(5-2*a(5))+1 = a(3)+1 = 2.

MATHEMATICA

Table[Floor[Sqrt[n-1]] + ((-1)^(n+Floor[Sqrt[n]])-1)/2, {n, 87}] (* Stefano Spezia, Dec 29 2020 *)

PROG

(Python)

a = [0, 0]

for n in range(1, 1000):

    a.append(a[n-2*a[n]]+1)

CROSSREFS

For a(n+1) = a(n-a(n)) + 1, starting with a(1) = 0, see A003056.

Cf. A339929, A330772, A005206.

Sequence in context: A096446 A274701 A184956 * A218469 A343333 A230502

Adjacent sequences:  A340131 A340132 A340133 * A340135 A340136 A340137

KEYWORD

nonn

AUTHOR

Rok Cestnik, Dec 29 2020

EXTENSIONS

More terms from Stefano Spezia, Dec 29 2020

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 September 21 20:10 EDT 2021. Contains 347598 sequences. (Running on oeis4.)