login
A086223
Every integer can be represented uniquely as m = k*2^(j+1)+2^j-1. Sequence gives values of k for m = repunit(n).
1
0, 1, 3, 69, 694, 6944, 69444, 694444, 6944444, 69444444, 694444444, 6944444444, 69444444444, 694444444444, 6944444444444, 69444444444444, 694444444444444, 6944444444444444, 69444444444444444, 694444444444444444
OFFSET
1,3
COMMENTS
j = A007814(m+1).
FORMULA
a(n) = A025480(A002275(n)).
G.f.: -x^2*(35*x^3-46*x^2+8*x-1) / ((x-1)*(10*x-1)). - Colin Barker, Apr 29 2015
a(n) = (125*10^(n-3)-8)/18 for n >= 4. - Robert Israel, Apr 29 2015
a(n) = 11*a(n-1)-10*a(n-2) for n>5.
EXAMPLE
1 = 0*4+1; 11 = 1*8+3; 111 = 3*32+15.
For n > 3, repunit(n) = [69*10^(n-4)+(10^(n-4)-1)*4/9]*16+7.
MATHEMATICA
CoefficientList[Series[x (35 x^3 - 46 x^2 + 8 x - 1)/((1 - x)(10 x - 1)), {x, 0, 20}], x] (* Vincenzo Librandi, Apr 30 2015 *)
PROG
(PARI) concat(0, Vec(-x^2*(35*x^3-46*x^2+8*x-1)/((x-1)*(10*x-1)) + O(x^100))) \\ Colin Barker, Apr 30 2015
(Magma) [0, 1, 3] cat [(125*10^(n-3)-8)/18: n in [4..25]]; // Vincenzo Librandi, Apr 30 2015
(Python)
def A086223(n): return (-(k:=(m:=(10**n-1)//9)&~(m+1))+m+1)//((k+1)<<1) # Chai Wah Wu, Jul 07 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Marco Matosic, Jul 27 2003
EXTENSIONS
Edited and extended by David Wasserman, Feb 17 2005
STATUS
approved