A249223 Triangle read by rows: row n gives partial alternating sums of row n of A237048.
1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 2, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 2, 2, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2
Offset: 1
Examples
Triangle begins: --------------------------- n \ k 1 2 3 4 5 6 --------------------------- 1 | 1; 2 | 1; 3 | 1, 0; 4 | 1, 1; 5 | 1, 0; 6 | 1, 1, 2; 7 | 1, 0, 0; 8 | 1, 1, 1; 9 | 1, 0, 1; 10 | 1, 1, 1, 0; 11 | 1, 0, 0, 0; 12 | 1, 1, 2, 2; 13 | 1, 0, 0, 0; 14 | 1, 1, 1, 0; 15 | 1, 0, 1, 1, 2; 16 | 1, 1, 1, 1, 1; 17 | 1, 0, 0, 0, 0; 18 | 1, 1, 2, 1, 1; 19 | 1, 0, 0, 0, 0; 20 | 1, 1, 1, 1, 2; 21 | 1, 0, 1, 1, 1, 0; 22 | 1, 1, 1, 0, 0, 0; 23 | 1, 0, 0, 0, 0, 0; 24 | 1, 1, 2, 2, 2, 2; ... The triangle shows that area(n) has width 1 for powers of 2 and that area(p) for primes p consists of only 1 horizontal leg of width 1 (and its symmetric vertical leg in the mirror symmetric duplicate of this triangle).
Links
- G. C. Greubel, Table of n, a(n) for the first 150 rows, flattened
- Hartmut F. W. Hoft, Divisors d of n in half open interval (k/2, k]
Crossrefs
Programs
-
Maple
r := proc(n) floor((sqrt(1+8*n)-1)/2) ; end proc: # R. J. Mathar 2015 A003056 A237048:=proc(n,k) local i; global r; if n<(k-1)*k/2 or k>r(n) then return(0); fi; if (k mod 2)=1 and (n mod k)=0 then return(1); fi; if (k mod 2)=0 and ((n-k/2) mod k) = 0 then return(1); fi; return(0); end; A249223:=proc(n,k) local i; global r,A237048; if n<(k-1)*k/2 or k>r(n) then return(0); fi; add( (-1)^(i+1)*A237048(n,i),i=1..k); end; for n from 1 to 12 do lprint([seq(A249223(n,k),k=1..r(n))]); od; # N. J. A. Sloane, Jan 15 2021
-
Mathematica
cd[n_, k_] := If[Divisible[n, k], 1, 0]; row[n_] := Floor[(Sqrt[8 n + 1] - 1)/2]; a237048[n_, k_] := If[OddQ[k], cd[n, k], cd[n - k/2, k]]; a1[n_, k_] := Sum[(-1)^(j + 1)*a237048[n, j], {j, 1, k}]; a2[n_] := Drop[FoldList[Plus, 0, Map[(-1)^(# + 1) &, Range[row[n]]] a237048[n]], 1]; Flatten[Map[a2, Range[24]]] (* data *) (* Corrected by G. C. Greubel, Apr 16 2017 *)
-
PARI
t237048(n,k) = if (k % 2, (n % k) == 0, ((n - k/2) % k) == 0); kmax(n) = (sqrt(1+8*n)-1)/2; t(n,k) = sum(j=1, k, (-1)^(j+1)*t237048(n,j)); tabf(nn) = {for (n=1, nn, for (k=1, kmax(n), print1(t(n,k), ", ");); print(););} \\ Michel Marcus, Sep 20 2015
Formula
T(n, k) = Sum_{j=1..k} (-1)^(j+1)*A237048(n, j), for n>=1 and 1 <= k <= floor((sqrt(8*n + 1) - 1)/2). - corrected by Hartmut F. W. Hoft, Jan 25 2018
Comments