A070871 a(n) = A002487(n) * A002487(n+1) (Conway's alimentary function).
1, 2, 2, 3, 6, 6, 3, 4, 12, 15, 10, 10, 15, 12, 4, 5, 20, 28, 21, 24, 40, 35, 14, 14, 35, 40, 24, 21, 28, 20, 5, 6, 30, 45, 36, 44, 77, 70, 30, 33, 88, 104, 65, 60, 84, 63, 18, 18, 63, 84, 60, 65, 104, 88, 33, 30, 70, 77, 44, 36, 45, 30, 6, 7, 42, 66
Offset: 1
Keywords
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..16384
- Robert G. Wilson v, Plot of first 4096 terms
Programs
-
Maple
b:= proc(n) option remember; `if`(n<2, n, (q-> b(q)+(n-2*q)*b(n-q))(iquo(n, 2))) end: a:= n-> b(n)*b(n+1): seq(a(n), n=1..100); # Alois P. Heinz, Feb 11 2021
-
Mathematica
a[0] = 1; a[n_] := If[ OddQ[n], a[n/2 - 1/2], a[n/2] + a[n/2 - 1]]; Table[ a[n - 1]*a[n], {n, 1, 70}]
-
Python
def a002487(n): return n if n<2 else a002487(n/2) if n%2==0 else a002487((n - 1)/2) + a002487((n + 1)/2) def a(n): return a002487(n)*a002487(n + 1) # Indranil Ghosh, Jun 08 2017
-
Python
from functools import reduce def A070871(n): return 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)))*sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n+1)[-1:2:-1],(1,0))) # Chai Wah Wu, May 05 2023
Formula
Sum of reciprocals of k-th "chunk" (between two entries k) = 1 (for example for the third chunk, 1/3 + 1/6 + 1/6 + 1/3 = 1).