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.

Showing 1-4 of 4 results.

A332498 a(n) = y(w+1) where y(0) = 0 and y(k+1) = 2^(k+1)-1-y(k) (resp. y(k)) when d_k = 2 (resp. d_k <> 2) and Sum_{k=0..w} d_k*3^k is the ternary representation of n. Sequence A332497 gives corresponding x's.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 3, 3, 2, 0, 0, 1, 0, 0, 1, 3, 3, 2, 7, 7, 6, 7, 7, 6, 4, 4, 5, 0, 0, 1, 0, 0, 1, 3, 3, 2, 0, 0, 1, 0, 0, 1, 3, 3, 2, 7, 7, 6, 7, 7, 6, 4, 4, 5, 15, 15, 14, 15, 15, 14, 12, 12, 13, 15, 15, 14, 15, 15, 14, 12, 12, 13, 8, 8, 9, 8, 8, 9, 11, 11
Offset: 0

Views

Author

Rémy Sigrist, Feb 14 2020

Keywords

Examples

			For n = 42:
- the ternary representation of 42 is "1120",
- x(0) = 0,
- x(1) = x(0) = 0 (as d_0 = 0),
- x(2) = 2^2-1 - x(1) = 3 (as d_1 = 2),
- x(3) = x(2) = 3 (as d_2 = 1 <> 2),
- x(4) = x(3) = 3 (as d_3 = 1 <> 2),
- hence a(42) = 3.
		

Crossrefs

Cf. A005836, A332497 (corresponding x's and additional comments).

Programs

  • PARI
    a(n) = { my (y=0, k=1); while (n, if (n%3==2, y=2^k-1-y); n\=3; k++); y }

Formula

a(n) = 0 iff n belongs to A005836.

A332412 a(n) is the real part of f(n) = Sum_{d_k > 0} 3^k * i^(d_k-1) where Sum_{k >= 0} 5^k * d_k is the base 5 representation of n and i denotes the imaginary unit. Sequence A332413 gives imaginary parts.

Original entry on oeis.org

0, 1, 0, -1, 0, 3, 4, 3, 2, 3, 0, 1, 0, -1, 0, -3, -2, -3, -4, -3, 0, 1, 0, -1, 0, 9, 10, 9, 8, 9, 12, 13, 12, 11, 12, 9, 10, 9, 8, 9, 6, 7, 6, 5, 6, 9, 10, 9, 8, 9, 0, 1, 0, -1, 0, 3, 4, 3, 2, 3, 0, 1, 0, -1, 0, -3, -2, -3, -4, -3, 0, 1, 0, -1, 0, -9, -8, -9
Offset: 0

Views

Author

Rémy Sigrist, Feb 12 2020

Keywords

Comments

The representation of {f(n)} corresponds to the cross form of the Vicsek fractal.
As a set, {f(n)} corresponds to the Gaussian integers whose real and imaginary parts have not simultaneously a nonzero digit at the same place in their balanced ternary representations.

Examples

			For n = 103:
- 103 = 4*5^2 + 3*5^0,
- so f(123) = 3^2 * i^(4-1) + 3^0 * i^(3-1) = -1 - 9*i,
- and a(n) = -1.
		

Crossrefs

See A332497 for a similar sequence.
Cf. A031219, A289813, A332413 (imaginary parts).

Programs

  • PARI
    a(n) = { my (d=Vecrev(digits(n,5))); real(sum (k=1, #d, if (d[k], 3^(k-1)*I^(d[k]-1), 0))) }

Formula

a(n) = 0 iff the n-th row of A031219 has only even terms.
a(5*n) = 3*a(n).
a(5*n+1) = 3*a(n) + 1.
a(5*n+2) = 3*a(n).
a(5*n+3) = 3*a(n) - 1.
a(5*n+4) = 3*a(n).

A339601 Starting from x_0 = n, iterate by dividing with 3 (discarding any remainder), until zero is reached: x_1 = floor(x_0/3), x_2 = floor(x_1/3), etc. Then a(n) = Sum_{i=0..} (x_i AND 2^i), where AND is bitwise-and.

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 6, 7, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 6, 7, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 6, 7, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3
Offset: 0

Views

Author

Antti Karttunen, Dec 09 2020

Keywords

Crossrefs

Cf. also A332497.

Programs

  • Mathematica
    Array[Total@ MapIndexed[BitAnd[2^First[#2 - 1], #1] &, NestWhileList[Floor[#/3] &, #, # > 0 &]] &, 106, 0] (* Michael De Vlieger, Dec 10 2020 *)
  • PARI
    A339601(n) = { my(i=0, s=0); while(n, s += bitand(2^i,n); i++; n \= 3); (s); };
    
  • PARI
    A339601(n) = { my(m=1, s=0); while(n>=m, s += bitand(m,n); m <<= 1; n \= 3); (s); };

A363710 a(n) is the number of pairs of nonnegative integers (x, y) such that x + y = n and A003188(x) AND A003188(y) = 0 (where AND denotes the bitwise AND operator).

Original entry on oeis.org

1, 2, 2, 2, 4, 4, 2, 2, 4, 8, 6, 4, 6, 4, 2, 2, 4, 8, 10, 8, 12, 12, 6, 4, 6, 12, 8, 4, 6, 4, 2, 2, 4, 8, 10, 8, 16, 20, 10, 8, 12, 24, 20, 12, 16, 12, 6, 4, 6, 12, 16, 12, 16, 16, 8, 4, 6, 12, 8, 4, 6, 4, 2, 2, 4, 8, 10, 8, 16, 20, 10, 8, 16, 32, 28, 20, 28
Offset: 0

Views

Author

Rémy Sigrist, Jun 17 2023

Keywords

Comments

Equivalently, a(n) is the number of k >= 0 such that A332497(k) + A332498(k) = n.
The set of pairs of nonnegative integers (x, y) such that A003188(x) AND A003188(y) = 0 is related to the T-square fractal (see illustration in Links section).

Examples

			For n = 8:
- we have:
  k  A332497(8-k)  A332497(k)  A332497(8-k) AND A332497(k)
  -  ------------  ----------  ---------------------------
  0            12           0                            0
  1             4           1                            0
  2             5           3                            1
  3             7           2                            2
  4             6           6                            6
  5             2           7                            2
  6             3           5                            1
  7             1           4                            0
  8             0          12                            0
- so a(8) = 4.
		

Crossrefs

Programs

  • PARI
    a(n) = 2*sum(k=0, n\2, bitand(bitxor(n-k, (n-k)\2), bitxor(k, k\2))==0) - (n==0)
    
  • Python
    A363710=lambda n: sum(map(lambda k: not (k^k>>1)&(n-k^n-k>>1),range(n+1>>1)))<<1 if n else 1 # Natalia L. Skirrow, Jun 22 2023

Formula

a(n) = 2 iff n belongs to A075427.
Showing 1-4 of 4 results.