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!)
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
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.
Sequence in context: A096446 A274701 A184956 * A218469 A343333 A230502
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 10 14:31 EDT 2023. Contains 363205 sequences. (Running on oeis4.)