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), ...

This page as a plain text file.
%I A269158 #24 Sep 11 2017 06:17:29
%S A269158 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,
%T A269158 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,
%U A269158 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
%N 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), ...
%C A269158 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.
%C A269158 Any row n occurs also as row (4^k * n), for all k >= 0.
%H A269158 Antti Karttunen, <a href="/A269158/b269158.txt">Table of n, a(n) for n = 1..32896; the first 256 antidiagonals of the array</a>
%F A269158 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).
%e A269158 The top left [1 .. 16] x [1 .. 25] section of the array:
%e A269158 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
%e A269158 1,  2,  7,  4, 13, 14, 11,  8, 25, 26, 31, 28, 21, 22, 19, 16
%e A269158 1,  3,  3,  3,  1,  1,  1,  3,  3,  3,  1,  1,  1,  3,  3,  3
%e A269158 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
%e A269158 1,  2,  5,  2,  1,  1,  6,  5,  6,  1,  5,  6,  1,  6,  5,  5
%e A269158 0,  1,  4,  7, 12, 15, 10, 11, 26, 25, 30, 29, 20, 21, 16, 19
%e A269158 1,  0,  7,  7,  5,  3,  2,  7,  2,  1,  5,  3,  1,  4,  5,  4
%e A269158 1,  2,  7,  4, 13, 14, 11,  8, 25, 26, 31, 28, 21, 22, 19, 16
%e A269158 1,  0,  0,  4,  9,  4,  9,  5, 12,  1,  0,  0, 12,  9,  4,  9
%e A269158 0,  0,  2,  6, 12, 15, 13, 13, 31, 27, 26, 26, 20, 16, 22, 21
%e A269158 1,  2,  0,  0, 13, 11,  7, 11, 14, 13, 14,  3,  8, 10, 10, 15
%e A269158 1,  3,  3,  3,  1,  1,  1,  3,  3,  3,  1,  1,  1,  3,  3,  3
%e A269158 1,  0,  3,  7,  0, 14, 13,  6,  1, 11, 14,  8,  8,  9, 12, 11
%e A269158 0,  2,  0,  3,  8, 13,  9, 15, 27, 27, 26, 31, 20, 18, 22, 20
%e A269158 1,  0,  0,  0, 12,  0, 11, 15,  9,  3, 14, 15,  4,  8,  2, 15
%e A269158 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
%e A269158 1,  2,  7,  3, 13, 15,  0,  8, 17,  8, 17, 11,  8, 14, 18, 10
%e A269158 0,  2,  7,  0,  4, 10,  2, 13, 21, 27, 31, 28, 25, 31, 23, 25
%e A269158 1,  0,  0,  2,  0, 14, 10,  0, 25, 19, 11, 19,  8,  9, 10, 16
%e A269158 1,  2,  5,  2,  1,  1,  6,  5,  6,  1,  5,  6,  1,  6,  5,  5
%e A269158 1,  0,  0,  0,  1, 15, 11, 11,  0, 26, 21, 10, 17, 15, 10, 15
%e A269158 0,  0,  7,  4,  0,  5, 12,  3, 23, 23, 17, 31, 29, 28, 25, 31
%e A269158 1,  2,  3,  4,  1,  0, 13,  8, 26,  0, 31, 23, 13, 19,  8, 11
%e A269158 0,  1,  4,  7, 12, 15, 10, 11, 26, 25, 30, 29, 20, 21, 16, 19
%e A269158 1,  0,  0,  0,  5,  1,  1, 13, 25, 25,  0, 28, 25, 12, 25, 13
%t A269158 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]]];
%t A269158 A[n_, k_] := F[n, 2 k - 1];
%t A269158 Table[A[n - k, k], {n, 1, 14}, {k, 1, n}] // Flatten (* _Jean-François Alcover_, Sep 11 2017 *)
%o A269158 (Scheme)
%o A269158 (define (A269158 n) (A269158auxbi (A002260 n) (+ -1 (* 2 (A004736 n)))))
%o A269158 ;; A269158auxbi can be implemented either as a tail-recursive loop:
%o A269158 (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)))))))))
%o A269158 ;; Or a recurrence (reflecting the given recursive formula):
%o A269158 (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)))))
%Y A269158 Transpose: A269159.
%Y A269158 Column 1: Seems to be 0 followed by A039982.
%Y A269158 Column 32769: A268819.
%Y A269158 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).)
%Y A269158 Cf. A268816 (row 6, row 24, etc.).
%Y A269158 Cf. arrays A268829 and A268728 (variants), and also A268931.
%Y A269158 Cf. A003188, A003987, A004198.
%K A269158 nonn,tabl
%O A269158 1,5
%A A269158 _Antti Karttunen_, Feb 20 2016