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.

A284013 a(n) = n - A002487(n).

Original entry on oeis.org

0, 0, 1, 1, 3, 2, 4, 4, 7, 5, 7, 6, 10, 8, 11, 11, 15, 12, 14, 12, 17, 13, 17, 16, 22, 18, 21, 19, 25, 22, 26, 26, 31, 27, 29, 26, 32, 26, 31, 29, 37, 30, 34, 30, 39, 33, 39, 38, 46, 40, 43, 39, 47, 40, 46, 44, 53, 47, 51, 48, 56, 52, 57, 57, 63, 58, 60, 56, 63, 55, 61, 58, 68, 58, 63, 57, 69, 60, 68, 66, 77, 67, 71, 64, 76, 64
Offset: 0

Views

Author

Antti Karttunen, Mar 23 2017

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] :=If[n<2, n, If[ EvenQ[n], a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]]; Table[n - a[n], {n , 0, 100}] (* Indranil Ghosh, Mar 23 2017 *)
  • PARI
    A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
    for(n=0, 151, print1(n - A(n),", ")) \\ Indranil Ghosh, Mar 23 2017
    
  • Python
    def a(n): return n if n<2 else (a(n//2) if n%2==0 else a((n - 1)//2) + a((n + 1)//2))
    print([n - a(n) for n in range(101)]) # Indranil Ghosh, Mar 23 2017
    
  • Python
    from functools import reduce
    def A284013(n): return n-sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0))) if n else 0 # Chai Wah Wu, May 18 2023
  • Scheme
    (define (A284013 n) (- n (A002487 n))) ;; Code for A002487 given under that entry.
    

Formula

a(n) = n - A002487(n).