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.

A269158 Square array A(row,col) = F(row,(2*col)-1), where F(0,q) = F(1,q) = 0, F(2p,q) = F(p,q) XOR A003188(q), F(2p+1,q) = F(q mod 2p+1, 2p+1) XOR (2p+1 AND q). Array is read by descending antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ...

Original entry on oeis.org

0, 0, 1, 0, 2, 1, 0, 7, 3, 0, 0, 4, 3, 0, 1, 0, 13, 3, 0, 2, 0, 0, 14, 1, 0, 5, 1, 1, 0, 11, 1, 0, 2, 4, 0, 1, 0, 8, 1, 0, 1, 7, 7, 2, 1, 0, 25, 3, 0, 1, 12, 7, 7, 0, 0, 0, 26, 3, 0, 6, 15, 5, 4, 0, 0, 1, 0, 31, 3, 0, 5, 10, 3, 13, 4, 2, 2, 1, 0, 28, 1, 0, 6, 11, 2, 14, 9, 6, 0, 3, 1, 0, 21, 1, 0, 1, 26, 7, 11, 4, 12, 0, 3, 0, 0
Offset: 1

Views

Author

Antti Karttunen, Feb 20 2016

Keywords

Comments

The array gives the values of bivariate function F(p,q) which is well-defined only when q is odd, thus while here its argument p obtains all integer values from 1 onward, argument q gets only odd numbers 1, 3, 5, 7, 9, ... as its values.
Any row n occurs also as row (4^k * n), for all k >= 0.

Examples

			The top left [1 .. 16] x [1 .. 25] section of the array:
0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
1,  2,  7,  4, 13, 14, 11,  8, 25, 26, 31, 28, 21, 22, 19, 16
1,  3,  3,  3,  1,  1,  1,  3,  3,  3,  1,  1,  1,  3,  3,  3
0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
1,  2,  5,  2,  1,  1,  6,  5,  6,  1,  5,  6,  1,  6,  5,  5
0,  1,  4,  7, 12, 15, 10, 11, 26, 25, 30, 29, 20, 21, 16, 19
1,  0,  7,  7,  5,  3,  2,  7,  2,  1,  5,  3,  1,  4,  5,  4
1,  2,  7,  4, 13, 14, 11,  8, 25, 26, 31, 28, 21, 22, 19, 16
1,  0,  0,  4,  9,  4,  9,  5, 12,  1,  0,  0, 12,  9,  4,  9
0,  0,  2,  6, 12, 15, 13, 13, 31, 27, 26, 26, 20, 16, 22, 21
1,  2,  0,  0, 13, 11,  7, 11, 14, 13, 14,  3,  8, 10, 10, 15
1,  3,  3,  3,  1,  1,  1,  3,  3,  3,  1,  1,  1,  3,  3,  3
1,  0,  3,  7,  0, 14, 13,  6,  1, 11, 14,  8,  8,  9, 12, 11
0,  2,  0,  3,  8, 13,  9, 15, 27, 27, 26, 31, 20, 18, 22, 20
1,  0,  0,  0, 12,  0, 11, 15,  9,  3, 14, 15,  4,  8,  2, 15
0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
1,  2,  7,  3, 13, 15,  0,  8, 17,  8, 17, 11,  8, 14, 18, 10
0,  2,  7,  0,  4, 10,  2, 13, 21, 27, 31, 28, 25, 31, 23, 25
1,  0,  0,  2,  0, 14, 10,  0, 25, 19, 11, 19,  8,  9, 10, 16
1,  2,  5,  2,  1,  1,  6,  5,  6,  1,  5,  6,  1,  6,  5,  5
1,  0,  0,  0,  1, 15, 11, 11,  0, 26, 21, 10, 17, 15, 10, 15
0,  0,  7,  4,  0,  5, 12,  3, 23, 23, 17, 31, 29, 28, 25, 31
1,  2,  3,  4,  1,  0, 13,  8, 26,  0, 31, 23, 13, 19,  8, 11
0,  1,  4,  7, 12, 15, 10, 11, 26, 25, 30, 29, 20, 21, 16, 19
1,  0,  0,  0,  5,  1,  1, 13, 25, 25,  0, 28, 25, 12, 25, 13
		

Crossrefs

Transpose: A269159.
Column 1: Seems to be 0 followed by A039982.
Column 32769: A268819.
Cf. A065621 (occurs as row 2, row 8, and in general, as any row 2^(2n+1) for n >= 0. Seems to be also present as a slanted diagonal F(2n+1,2n-1).)
Cf. A268816 (row 6, row 24, etc.).
Cf. arrays A268829 and A268728 (variants), and also A268931.

Programs

  • Mathematica
    F[p_, q_] := F[p, q] = Which[p <= 1, 0, p > 1 && OddQ[p], F[Mod[q, p], p] ~BitXor~ BitAnd[p, q], True, F[p/2, q] ~BitXor~ BitXor[q, Floor[q/2]]];
    A[n_, k_] := F[n, 2 k - 1];
    Table[A[n - k, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Sep 11 2017 *)
  • Scheme
    (define (A269158 n) (A269158auxbi (A002260 n) (+ -1 (* 2 (A004736 n)))))
    ;; A269158auxbi can be implemented either as a tail-recursive loop:
    (define (A269158auxbi p q) (if (not (odd? q)) (error "A269158bi: the second argument should be odd: " p q) (let loop ((p p) (q q) (s 0)) (cond ((<= p 1) s) ((odd? p) (loop (modulo q p) p (A003987bi s (A004198bi p q)))) (else (loop (/ p 2) q (A003987bi s (A003987bi q (/ (- q 1) 2)))))))))
    ;; Or a recurrence (reflecting the given recursive formula):
    (define (A269158auxbi p q) (cond ((<= p 1) 0) ((even? p) (A003987bi (A269158auxbi (/ p 2) q) (A003188 q))) (else (A003987bi (A269158auxbi (modulo q p) p) (A004198bi p q)))))

Formula

A(row,col) = F(row,(2*col)-1), where function F is defined as: If p <= 1, F(p,q) = 0, otherwise if p is an odd number > 1, F(p,q) = F(q mod p, p) XOR (p AND q), otherwise [when p is an even number] F(p,q) = F(p/2,q) XOR A003188(q).