Skip to main content
added 26 characters in body; added 5 characters in body
Source Link
Notamathematician
  • 4.9k
  • 2
  • 11
  • 24
b(n) = my(A = n); for(i = 1, hammingweight(n) - 1, A++; A >>= 1 - valuation(A, 2)); A
f1(n) = if(n == 1, 2, my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((19*A - A^2 + 11*A^3)/(23*n))/log(A)))
f2(n) = if(n == 1, 2, my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((48*A - 11*A^2 + 29*A^3)/(23*(n+1)23*n))/log(A)))
c(n) = my(v1); v1 = vector(f1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = f1(n) + 1); A - (v1[A]>n), b2(n) = my(A = f2(n) + 1); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 1 << (B/2 + C - 1), C = b1(n-1); n -= v1[C]; A += 1 << ((B-1)/2 + C - 2)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = if(n == 1, 0, my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2))
test(n) = a(n) == a1(n)

It looks like that for $\operatorname{wt}(n)+2k-1, k\geqslant 0$ iterations similar conjectures are equivalent. Also, for $\operatorname{wt}(n)+2k, k\geqslant$ we have similar conjectures which are also equivalent to each other, but here we get A287066 instead of $a(n)$.

b(n) = my(A = n); for(i = 1, hammingweight(n) - 1, A++; A >>= 1 - valuation(A, 2)); A
f1(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((19*A - A^2 + 11*A^3)/(23*n))/log(A))
f2(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((48*A - 11*A^2 + 29*A^3)/(23*(n+1)))/log(A))
c(n) = my(v1); v1 = vector(f1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = f1(n) + 1); A - (v1[A]>n), b2(n) = my(A = f2(n) + 1); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 1 << (B/2 + C - 1), C = b1(n-1); n -= v1[C]; A += 1 << ((B-1)/2 + C - 2)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = if(n == 1, 0, my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2))
test(n) = a(n) == a1(n)

It looks like for $\operatorname{wt}(n)+2k-1, k\geqslant 0$ iterations similar conjectures are equivalent. Also, for $\operatorname{wt}(n)+2k, k\geqslant$ we have similar conjectures which are also equivalent to each other, but here we get A287066 instead of $a(n)$.

b(n) = my(A = n); for(i = 1, hammingweight(n) - 1, A++; A >>= 1 - valuation(A, 2)); A
f1(n) = if(n == 1, 2, my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((19*A - A^2 + 11*A^3)/(23*n))/log(A)))
f2(n) = if(n == 1, 2, my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((48*A - 11*A^2 + 29*A^3)/(23*n))/log(A)))
c(n) = my(v1); v1 = vector(f1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = f1(n) + 1); A - (v1[A]>n), b2(n) = my(A = f2(n) + 1); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 1 << (B/2 + C - 1), C = b1(n-1); n -= v1[C]; A += 1 << ((B-1)/2 + C - 2)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = if(n == 1, 0, my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2))
test(n) = a(n) == a1(n)

It looks like that for $\operatorname{wt}(n)+2k-1, k\geqslant 0$ iterations similar conjectures are equivalent. Also, for $\operatorname{wt}(n)+2k, k\geqslant$ we have similar conjectures which are also equivalent to each other, but here we get A287066 instead of $a(n)$.

deleted 142 characters in body; added 1 character in body; added 1 character in body
Source Link
Notamathematician
  • 4.9k
  • 2
  • 11
  • 24
  • Let $b(n)$ be a sequence of positive integers such that $b(n)=A$ after $\operatorname{wt}(n)+1$$\operatorname{wt}(n)-1$ iterations. To get $A$ start with $A = n$ and then apply
b(n) = my(A = n); for(i = 1, hammingweight(n) +- 1, A++; A >>= 1 - valuation(A, 2)); A
ff1(n) = my(A = 3solve(r=0, v1);1, v1r*(2 =- [0,r 1,+ 2];r^2)-1)); whileceil(!log(v1[A](19*A >- A^2 + 11*A^3)/(23*n))/log(A))
f2(n), v1= my(A = concatsolve(v1r=0, 2*v1[A]1, -r*(2 v1[A-1] r + v1[Ar^2)-2]1); A++); v1ceil(log((48*A - 11*A^2 + 29*A^3)/(23*(n+1)))/log(A))
c(n) = my(v1); v1 = fvector(f1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(c1b1(n) = my(A = 2f1(n); until(v1[A]>n,+ A++1); A -1 (v1[A]>n), c2b2(n) = my(A = 2f2(n); until(v2[A]>n,+ A++1); A -1 (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = c2b2(n-2); n -= v2[C] + 1; A += 2^1 << (B/2 + C - 1), C = c1b1(n-1); n -= v1[C]; A += 2^1 << ((B-1)/2 + C - 12)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = if(n == 1, 0, my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2))
test(n) = a(n) == a1(n)

Now you can computeIt looks like for $c(n)$ faster:$\operatorname{wt}(n)+2k-1, k\geqslant 0$ iterations similar conjectures are equivalent. Also, for $\operatorname{wt}(n)+2k, k\geqslant$ we have similar conjectures which are also equivalent to each other, but here we get A287066 instead of $a(n)$.

g1(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*n))/log(A))
g2(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*(n+1)*(1-A)))/log(A))
c1(n) = my(v1); v1 = vector(g1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = g1(n)); A - (v1[A]>n), b2(n) = my(A = g2(n)); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 2^(C+B/2), C = b1(n-1); n -= v1[C]; A += 2^(C+(B-1)/2-1)); B++); A + n
  • Let $b(n)$ be a sequence of positive integers such that $b(n)=A$ after $\operatorname{wt}(n)+1$ iterations. To get $A$ start with $A = n$ and then apply
b(n) = my(A = n); for(i = 1, hammingweight(n) + 1, A++; A >>= 1 - valuation(A, 2)); A
f(n) = my(A = 3, v1); v1 = [0, 1, 2]; while(!(v1[A] > n), v1 = concat(v1, 2*v1[A] - v1[A-1] + v1[A-2]); A++); v1
c(n) = my(v1); v1 = f(n); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(c1(n) = my(A = 2); until(v1[A]>n, A++); A-1, c2(n) = my(A = 2); until(v2[A]>n, A++); A-1, A = 0, B = 0, C); while(n > 2, if(!(B%2), C = c2(n-2); n -= v2[C] + 1; A += 2^(B/2 + C), C = c1(n-1); n -= v1[C]; A += 2^((B-1)/2 + C - 1)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2)
test(n) = a(n) == a1(n)

Now you can compute $c(n)$ faster:

g1(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*n))/log(A))
g2(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*(n+1)*(1-A)))/log(A))
c1(n) = my(v1); v1 = vector(g1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = g1(n)); A - (v1[A]>n), b2(n) = my(A = g2(n)); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 2^(C+B/2), C = b1(n-1); n -= v1[C]; A += 2^(C+(B-1)/2-1)); B++); A + n
  • Let $b(n)$ be a sequence of positive integers such that $b(n)=A$ after $\operatorname{wt}(n)-1$ iterations. To get $A$ start with $A = n$ and then apply
b(n) = my(A = n); for(i = 1, hammingweight(n) - 1, A++; A >>= 1 - valuation(A, 2)); A
f1(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((19*A - A^2 + 11*A^3)/(23*n))/log(A))
f2(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); ceil(log((48*A - 11*A^2 + 29*A^3)/(23*(n+1)))/log(A))
c(n) = my(v1); v1 = vector(f1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = f1(n) + 1); A - (v1[A]>n), b2(n) = my(A = f2(n) + 1); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 1 << (B/2 + C - 1), C = b1(n-1); n -= v1[C]; A += 1 << ((B-1)/2 + C - 2)); B++); A + n
a(n) = my(A = 2, v1); v1 = [0, 1]; while(#v1<n, v1 = concat(v1, if(v1[A]==2, [0], [v1[A], v1[A]+1])); A++); v1[n]
a1(n) = if(n == 1, 0, my(A = b(c(n))); if(A == b(c(n-1))/2, 2, valuation(A, 2)%2))
test(n) = a(n) == a1(n)

It looks like for $\operatorname{wt}(n)+2k-1, k\geqslant 0$ iterations similar conjectures are equivalent. Also, for $\operatorname{wt}(n)+2k, k\geqslant$ we have similar conjectures which are also equivalent to each other, but here we get A287066 instead of $a(n)$.

added 667 characters in body
Source Link
Notamathematician
  • 4.9k
  • 2
  • 11
  • 24

UPD:

Now you can compute $c(n)$ faster:

g1(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*n))/log(A))
g2(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*(n+1)*(1-A)))/log(A))
c1(n) = my(v1); v1 = vector(g1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = g1(n)); A - (v1[A]>n), b2(n) = my(A = g2(n)); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 2^(C+B/2), C = b1(n-1); n -= v1[C]; A += 2^(C+(B-1)/2-1)); B++); A + n

Is there a way to prove it?

Is there a way to prove it?

UPD:

Now you can compute $c(n)$ faster:

g1(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*n))/log(A))
g2(n) = my(A = solve(r=0, 1, r*(2 - r + r^2)-1)); round(log((19*A - A^2 - 11*A^3)/(23*(n+1)*(1-A)))/log(A))
c1(n) = my(v1); v1 = vector(g1(n)+1, i, 0); v1[2] = 1; v1[3] = 2; for(i = 4, #v1, v1[i] = 2*v1[i-1] - v1[i-2] + v1[i-3]); v2 = v1; for(i = 2, #v1, v2[i] += v2[i-1]); my(b1(n) = my(A = g1(n)); A - (v1[A]>n), b2(n) = my(A = g2(n)); A - (v2[A]>n), A = 0, B = 0, C); while(n > 2, if(!(B%2), C = b2(n-2); n -= v2[C] + 1; A += 2^(C+B/2), C = b1(n-1); n -= v1[C]; A += 2^(C+(B-1)/2-1)); B++); A + n

Is there a way to prove it?

deleted 37 characters in body
Source Link
Notamathematician
  • 4.9k
  • 2
  • 11
  • 24
Loading
case formula for a
Source Link
Max Alekseyev
  • 34.4k
  • 5
  • 74
  • 152
Loading
Source Link
Notamathematician
  • 4.9k
  • 2
  • 11
  • 24
Loading