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-2 of 2 results.

A209615 Completely multiplicative with a(p^e) = 1 if p == 1 (mod 4), a(p^e) = (-1)^e otherwise.

Original entry on oeis.org

1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1
Offset: 1

Views

Author

Michael Somos, Mar 10 2012

Keywords

Comments

Turn sequence of the alternate paperfolding curve. Davis and Knuth define the alternate paperfolding curve by folding a long strip of paper repeatedly in half alternately to the left side or right side, then unfolding it so each crease is 90 degrees (or other angle). a(n) is their d(n) at equation 4.2. Their equation 6.2 (varied to d(2) = -1 as described there) is equivalent to the definition here. The curve is drawn by a unit step forward, turn a(1)*90 degrees left, a unit step forward, turn a(2)*90 degrees left, and so on. - Kevin Ryde, Apr 18 2020

Examples

			G.f. = x - x^2 - x^3 + x^4 + x^5 + x^6 - x^7 - x^8 + x^9 - x^10 - x^11 - x^12 + ...
From _Kevin Ryde_, Apr 18 2020: (Start)
                   ...              alternate
                    | -1           paperfolding
            -1 --->\ \<--- +1         curve
             ^   -1 |      ^
             |      v      |      turns +1 left
  start --> +1     +1 ---> +1        or -1 right
(End)
		

References

  • Chandler Davis and Donald E. Knuth, Number Representations and Dragon Curves -- I and II, Journal of Recreational Mathematics, volume 3, number 2, April 1970, pages 66-81, and number 3, July 1970, pages 133-149. Reprinted in Donald E. Knuth, Selected Papers on Fun and Games, CSLI Publications, 2010, pages 571-614.

Crossrefs

Indices of 1: A338692 = A016813 U A343501; indices of -1: A338691 = A004767 U A343500.
Inverse Moebius transform gives A338690.

Programs

  • Mathematica
    A209615[n_] := JacobiSymbol[-1, n]*(-1)^IntegerExponent[n, 2];
    Array[A209615, 100] (* Paolo Xausa, Feb 26 2025 *)
  • PARI
    {a(n) = my(v); if( n==0, 0, v = valuation( n, 2); (-1)^(n/2^v\2 + v))};
    
  • PARI
    {a(n) = if( n!=0, -kronecker( -1, n) * (-1)^if( n!=0, 1 - valuation( n, 2) %2))};
    
  • PARI
    {a(n) = my(A, p, e, f); sign(n) * if( n==0, 0, A = factor(abs(n)); prod( k=1, matsize(A)[1], [p, e] = A[k, ]; (-1)^(e * (p%4 != 1))) )};
    
  • Python
    def A209615(n): return -1 if ((n>>(m:=(~n&n-1).bit_length()))+1>>1)+m&1^1 else 1 # Chai Wah Wu, Feb 25 2025

Formula

G.f.: Sum_{k>=0} (-1)^k * x^(2^k) / (1 + x^(2^(k+1))).
G.f. A(x) satisfies A(x) + A(x^2) = x / (1 + x^2).
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (v + w) - (u + v)^2 * (1 + 2*(v + w)).
If p is prime then a(p) = 1 if and only if p is in A002144.
a(4*n + 1) = 1, a(4*n + 3) = -1. a(2*n) = a(3*n) = a(-n) = -a(n).
a(n) = -(-1)^A106665(n-1) unless n=0.
a(2n) = -a(n), a(2n+1) = (-1)^n. [Davis and Knuth equation 4.2] - Kevin Ryde, Apr 18 2020
From Jianing Song, Apr 24 2021: (Start)
a(n) = 1 <=> A003324(n) = 1 or 4, a(n) = -1 <=> A003324(n) = 2 or 3. In other words, a(n) = Legendre(A003324(n), 5) == A003324(n)^2 (mod 5).
a(n) = A034947(n) * (-1)^(v2(n)), where v2(n) = A007814(n) is the 2-adic valuation of n.
Dirichlet g.f.: beta(s)/(1 + 2^(-s)). (End)

A350872 Number of coincidence site lattices of index n in square lattice.

Original entry on oeis.org

1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0
Offset: 1

Views

Author

Andrey Zabolotskiy, Jan 20 2022

Keywords

Comments

A coincidence site lattice (CSL), or coincidence sublattice, is a full-rank sublattice arising as an intersection of the parent lattice with its copy rotated around the origin. It is necessarily primitive.
A primitive sublattice of the square lattice is a CSL if it is square (i. e., similar to the parent lattice) and has odd index.
In this sequence, any two CSLs differing by any isometry are counted as distinct.
a(n) is also the number of ordered pairs of coprime integers (p, q) with p >= 0 and q > 0 such that p^2 + q^2 = n^2.

Examples

			a(5) = 2 index-5 CSLs have bases (2, 1), (-1, 2) and (1, 2), (-2, 1).
		

Crossrefs

Cf. A031358 (nonzero quadrisection), A004613 (positions of nonzero terms), A024362, A154269, A338690, A271102.
Cf. enumeration of wider classes of sublattices of Z^2: A000203 (all sublattices), A350871 (all well-rounded sublattices), A002654 (all square sublattices), A001615 (all primitive sublattices), A000089 (all primitive square sublattices).
Cf. enumeration of CSLs in other lattices: A331140 (Z^4), A331139 (D_4), A331142 (A_4).

Programs

  • Mathematica
    csl[1] = 1;
    csl[n_] := With[{f = First@Transpose@FactorInteger@n}, If[Union@Mod[f, 4] == {1}, 2^Length@f, 0]];
    Array[csl, 87]
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i, 1]%4 == 1, 2, 0));} \\ Amiram Eldar, Oct 23 2023

Formula

Multiplicative with a(p^e) = 2 if p == 1 (mod 4), otherwise 0.
a(4*n+1) = A031358(n), other terms are 0.
a(n) = 2 * A024362(n) for n > 1.
Dirichlet convolution of A000089 and A154269.
Dirichlet convolution of A338690 and A271102.
From Amiram Eldar, Oct 23 2023: (Start)
Dirichlet g.f.: Product_{primes p == 1 (mod 4)} (1 + 1/p^s)/(1 - 1/p^s).
Sum_{k=1..n} a(k) = (1/Pi) * n + O(sqrt(n)*log(n)).
(both from Baake and Zeiner, 2017) (End)
Showing 1-2 of 2 results.