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.

A378761 Irregular triangle read by rows: T(n,k) for k <= n/2 is the number of partitions of the repunit A002275(n) into k nonzero complementary binary vectors having a common divisor > 1 in base 10.

Original entry on oeis.org

1, 1, 1, 3, 1, 0, 1, 19, 6, 1, 0, 0, 1, 47, 98, 29, 1, 84, 280, 0, 1, 141, 650, 600, 120, 1, 0, 0, 0, 0, 1, 1135, 16734, 28063, 5922, 756, 1, 130, 130, 13, 0, 0, 1, 1779, 43757, 161700, 161700, 52920, 5040, 1, 6183, 263386, 1401900, 1401400, 0, 0, 1, 9919, 438582, 2634549, 4381246, 2587326, 577612, 40913, 1, 0, 0, 0, 0, 0, 0, 0, 1, 75433
Offset: 2

Views

Author

Dmytro Inosov, Dec 06 2024

Keywords

Comments

We call a k-tuple of binary vectors of length n complementary if for every position m (1 <= m <= n) the digit "1" occurs on that position in exactly one of the vectors. For example, {1010, 0100, 0001} is a triple (k=3) of complementary binary vectors of length n=4. The sum of complementary binary vectors of length n is always a repunit of the same length, A002275(n).
T(n,k) gives the number of distinct unordered k-tuples of complementary binary vectors of length n that have a common divisor > 1 as integers in base 10.
For k > n/2, at least one of the binary vectors must contain just a single "1" (with all other digits zero) and is, therefore, a power of 10 (A011557). Hence it cannot have nontrivial common divisors with the repunit A002275(n), which implies T(n,k) = 0. The requirement k <= n/2 acts to skip the corresponding trivial zero terms.
The partitions for k = 1 are trivial and consist of one element -- the repunit itself, which is its own greatest common divisor. Therefore, T(n,1) = 1 for n >= 2.
If T(n,k)=0 for some n and k, then T(n,m)=0 also for any m >= k. Indeed, if some m-tuple of binary vectors existed that is counted toward T(n,m), then an (m-1)-tuple obtained by summing any two of its vectors while leaving others unchanged would be counted toward T(n,m-1). By induction, this leads to T(n,k)>0, which is a contradiction.
Consequently, T(n,k) = 0 for all k > 1 whenever A378511(n) = 1. This holds, in particular, for all n in A004023 (indices of prime repunits).

Examples

			The triangle T(n,k) starts (omitting terms with k > n/2, which are zero):
-----------------------------------------------------------------------------------------
n\k: 1,       2,         3,         4,         5,         6,        7,       8,   9,  ...
-----------------------------------------------------------------------------------------
 2 | 1;
 3 | 1;
 4 | 1,       3;
 5 | 1,       0;
 6 | 1,      19,         6;
 7 | 1,       0,         0;
 8 | 1,      47,        98,        29;
 9 | 1,      84,       280,         0;
10 | 1,     141,       650,       600,       120;
11 | 1,       0,         0,         0,         0;
12 | 1,    1135,     16734,     28063,      5922,       756;
13 | 1,     130,       130,        13,         0,         0;
14 | 1,    1779,     43757,    161700,    161700,     52920,     5040;
15 | 1,    6183,    263386,   1401900,   1401400,         0,        0;
16 | 1,    9919,    438582,   2634549,   4381246,   2587326,   577612,   40913;
17 | 1,       0,         0,         0,         0,         0,        0,       0;
18 | 1,   75433,  10808037, 140403209, 391178517, 290493433, 39663279, 6540609, 362880;
19 | 1,       0,         0,         0,         0,         0,        0,       0,      0;
20 | 1,  124467,  26825456, 514583021, ...
... (for more terms, see the A-file).
T(6,3) = 6 because among the {n,k} = 90 possible triples of nonzero binary vectors of length 6 there are exactly 6 with a common divisor > 1:
  {100001, 010010, 001100}: GCD(100001, 10010, 1100) = 11;
  {100001, 011000, 000110}: GCD(100001, 11000, 110) = 11;
  {100100, 010010, 001001}: GCD(100100, 10010, 1001) = 1001;
  {100100, 011000, 000011}: GCD(100100, 11000, 11) = 11;
  {110000, 001001, 000110}: GCD(110000, 1001, 110) = 11;
  {110000, 001100, 000011}: GCD(110000, 1100, 11) = 11.
The quadruple of binary vectors {1100000001000, 0010001100000, 0001100000001, 0000010010110} counts toward T(13,4) because in base 10, GCD(1100000001000, 10001100000, 1100000001, 10010110) = 53. In total, there are 13 such quadruples of length 13. This exemplifies the smallest prime n with nontrivial T(n,k).
T(17,k) = 0 for k >= 2 since A378511(17) = 1 (though 17 isn't a term in A004023).
T(317,k) = 0 for k >= 2 since 317 is a term in A004023.
		

Crossrefs

Programs

  • Mathematica
    Clear[SubListNonCoprimes];
    SubListNonCoprimes[bnum_, m_] := SubListNonCoprimes[bnum, m] =
      (If[m == 1, Return[If[bnum == Repunit, Nothing, {Repunit - bnum}]]];
      ListOfParts2 = Select[Total[10^(ResourceFunction["KSetPartitions"][(#)[[Range[Length[#]]]], 2] &[Position[IntegerDigits[bnum] // Reverse, 0] // Flatten] - 1), {3}] /. 0 -> {}, GCD @@ Prepend[#, bnum] > 1 &];
      If[m == 2, ListOfParts2, Select[Flatten[MapApply[Append]@*Thread@*
    Comap[{SubListNonCoprimes[# + bnum, m-1] &, Identity}] @* Max /@ ListOfParts2, 1], GCD @@ Prepend[#, bnum] > 1 &]]);
    SubCountNonCoprimes10[n_, m_, k_, totk_] := (Result = 0; Do[If[!CoprimeQ[#, Repunit-#],
    Result += Length[SubListNonCoprimes[#, m-1]]] &[FromDigits[IntegerDigits[i, 2]]], {i, #[[k]], #[[k+1]]-1}] &[Round[Subdivide[2^(n-1), 2^n, totk]]];
      Result);
    CountNonCoprimes10[n_, m_] := (If[m > n/2, Return[0], If[m == 1, Return[1]]];
      Repunit = (10^n - 1)/9; ParallelSum[SubCountNonCoprimes10[n, m, k, #], {k, #}, Method -> "FinestGrained", ProgressReporting -> (n >= 15)] &[If[n >= 15, 100, 1] $KernelCount]);
    Table[CountNonCoprimes10[n, k], {n, 2, 16}, {k, 1, 8}] // TableForm

Formula

T(n,k) = 0 for k > n/2 (such terms are skipped as trivial zeros).
T(n,1) = 1 for n >= 2.
T(n,1) + T(n,2) = A378511(n).
Sum_{k} T(n,k) = A385539(n) (row sums).
T(n,k) = Stirling2(n,k) - A378154(n,k) for 2 <= k <= 9.
T(A004023(n),k) = 0 for k >= 2.

A376918 Number of digit patterns of length n without common prime factors of a different digital type.

Original entry on oeis.org

1, 2, 4, 11, 51, 177, 876, 3965, 20782, 114462, 678568, 4160919, 27640938, 190402900, 1378295071, 10437144322, 82285618466, 671415306221, 5676395537455
Offset: 1

Views

Author

Dmytro Inosov, Oct 10 2024

Keywords

Comments

a(n) gives the number of distinct digit patterns (or digital types, as per A266946) such that all integers of that digital type share no common prime factor of a different digital type.
The number of remaining digit patterns not counted toward a(n) is given by A378199(n).
To check whether a digit pattern of length n with distinct digits A,B,... should be counted toward a(n), write that pattern as a linear combination of the form X1*A + X2*B + ..., where the pattern coefficients X1,X2,... consist of 0's and 1's (A007088), with 1's on positions of the corresponding digit in the pattern.
If GCD(X1,X2,...) has no prime divisors with a different digit pattern from the one we started from, the pattern is counted toward a(n). Otherwise, it is excluded.
For n of the form 10m + 3q (with m >= 1 and q >= 0), check in addition if the pattern contains all 10 distinct digits whose number of occurrences taken modulo 3 is the same for all digits from A to J. Since A + B + ... + J = 45, which is divisible by 9, such patterns are not counted toward a(n) and should be excluded.
The digital types excluded in this way result in composites for any values of the distinct digits in the pattern, without the need to run primality tests on all numbers of that digital type individually.
The requirement for a divisor of a different digital type only affects reprigits of the form AA..AA and acts to include that pattern iff the n-repunit is prime (n in A004023).
a(n) gives the upper bound for the number of distinct digital types of n-digit primes A267013(n). The two sequences are distinct, since some digit patterns such as "AAABBCABCCCAACCB" happen to contain no primes accidentally, without having a common divisor. We call such patterns primonumerophobic. Sequence A377727 = {a(n)-A267013(n)}_(n>=1) gives the number of primonumerophobic digit patterns of length n.
a(n) coincides with A267013(n) for n<10 because the shortest primonumerophobic digit patterns "AAABBBAAAB", "AABABBBBBA", and "ABAAAAABBB" have length 10.
a(n) represents row sums of T(n,k) in A378154 -- an array of contributions to a(n) with exactly k<=10 distinct decimal digits.
A164864(n) gives the total number of possible digit patterns of length n and is therefore an upper bound for a(n).

Examples

			The pattern "ABCA" is counted toward a(4) because ABCA = A*1001 + B*100 + C*10. Since GCD(1001,100,10) = 1, integers of the digital type "ABCA" (1021 in A266946) share no common prime factors.
The pattern "AA" is counted toward a(2) because AA = A*11, and 11 is a prime repunit. The only common prime factor shared by the repdigits "AA" is 11, which is of the same digital type as the original pattern.
The pattern "ABAB" is not counted toward a(4) because it is divisible by 101 for any A > 0 and B >= 0, and 101 has a different digital type from ABAB. Indeed, ABAB = A*1010+B*101, which is identically divisible by 101. In total there are four 4-digit patterns that are excluded: ABBA, AABB, AAAA (all of them divisible by 11) and ABAB (divisible by 101). Therefore, a(4) = A164864(4)-4 = 11.
The pattern "ABCDEFGHIJ" that contains all possible digits exactly once does not contribute to a(10) because its sum of digits is 1+2+...+9 = 45, which is divisible by 9. Therefore, all integers with the digital type "ABCDEFGHIJ" share the common prime factor 3.
a(23) = 37135226382208300 -- the fact that n = 23 is a term in A004023 (indices of prime repunits) simplifies the calculation of A378154(n,k) since A378761(23,k) = 0 for all k > 1. - _Dmytro Inosov_, Dec 21 2024
		

Crossrefs

Programs

  • Mathematica
    MinLength = 1; MaxLength = 12; (* the range of n to calculate a(n) for *)
    (* Function that calculates the canonical form A358497(n) *)
    A358497[k_] := FromDigits@a358497C[k]
    a358497C = Compile[{{k, _Integer}}, Module[{firstpos = ConstantArray[0, 10],
      digits = IntegerDigits[k], indx = 0}, Table[If[firstpos[[digits[[j]] + 1]] == 0, firstpos[[digits[[j]] + 1]] = Mod[++indx,10]];
      firstpos[[digits[[j]] + 1]], {j, Length[digits]}]]];
    (* Function that checks if a common prime factor of a different digital type exists *)
    DivisibilityRulesQ[pat_] := (
      If[Divisible[Length[pat], 10] && Length[Counts[pat]] == 10 &&
         AllTrue[Table[Counts[pat][[i]] == Length[pat]/10, {i, 1, 10}], TrueQ], Return[True]];
      (# != 1) && AnyTrue[Extract[# // FactorInteger, {All, 1}],
         A358497[#] != A358497[pat // FromDigits] &] &[
         Apply[GCD, Total[10^(Position[Reverse[pat], #]-1) // Flatten]& /@
         Mod[Range[CountDistinct[pat]], 10]]]
    );
    (* Function that generates all patterns that do not satisfy divisibility rules *)
    Patterns[len_, k_] := (
      Clear[dfs];
      ResultingPatterns = {};
      dfs[number_List] := If[Length[number] == len,
        If[Length[Union[If[# < 10, #, 0] & /@ number]] == k,
          AppendTo[ResultingPatterns, If[# < 10, #, 0] & /@ number]],
        Do[If[i <= 10, dfs[Append[number, i]]], {i, Range[1, Last[Union[number]] + 1]}]];
      dfs[{1}];
      FromDigits /@ Select[ResultingPatterns, ! DivisibilityRulesQ[#] &]
    );
    (* Counting the patterns T(n,k) as per A378154 and their row sums a(n) *)
    Do[Print[{n, #, Sum[#[[m]], {m, 1, Length[#]}]}] &[Table[Length[Patterns[n, j]], {j, 1, Min[10, n]}]], {n, MinLength, MaxLength}];

Formula

a(n) = Sum_{k=1..min(n,10)} T(n,k) -- row sums of A378154.
A267013(n) <= a(n) <= A164864(n).
a(n) = A164864(n) - A378199(n).
a(n) = A267013(n) + A377727(n).

Extensions

a(13)-a(19) from Dmytro Inosov, Dec 23 2024

A378511 Number of partitions of the repunit A002275(n) into two mutually complementary binary vectors having a common divisor > 1 in base 10.

Original entry on oeis.org

1, 0, 1, 1, 4, 1, 20, 1, 48, 85, 142, 1, 1136, 131, 1780, 6184, 9920, 1, 75434, 1, 124468, 369142, 429508, 1, 4797008, 416966, 6114994, 22482400, 28867896, 111651, 306153842, 384525, 507438240, 1483501078, 1242075014, 743845629, 19710473036, 34300, 17721793660
Offset: 0

Views

Author

Dmytro Inosov, Nov 29 2024

Keywords

Comments

Two binary vectors of length n are mutually complementary if they are obtained from each other by inverting all the individual digits (1->0 and 0->1). The sum of any two mutually complementary binary vectors of length n is a repunit of the same length, A002275(n).
a(n) is the number of distinct unordered pairs of mutually complementary binary vectors of length n that have a common divisor > 1 as integers in base 10.
a(n) is the number of terms m in A007088 of length n that are not coprime with their 1's complement, A002275(n) - m, as integers in base 10.
Equivalently, m from A007088 is counted toward a(A055642(m)) iff GCD(m, A002275(A055642(m)) - m) > 1. Therefore a(n) is the base-10 analog of A378514.
a(n) is the sum of the first two columns, T(n,1) + T(n,2), in the triangle A378761.
For any n > 1, a(n) > 0 because the trivial partition A002275(n) = A002275(n) + 0 always counts toward a(n): GCD(A002275(n), 0) = A002275(n) > 1.
a(n) is nonmonotonic and tends to show minima for prime n, yet there are terms where n is prime yet a(n) > 1, for example a(13) = 131.
The sequence of indices n such that a(n) = 1 is a supersequence of A004023 (indices of prime repunits).

Examples

			a(1) = 0 because there is only one pair {1, 0} of mutually complementary binary vectors of length 1, and GCD(1, 0) = 1.
a(2) = 1 because out of 2 possible pairs of binary vectors of length 2, which are {10, 01} and {11, 00}, only the latter has a common divisor q > 1: q = GCD(11, 0) = 11, whereas the former is coprime, GCD(10, 1) = 1.
a(4) = 4 because out of the 8 possible pairs of mutually complementary binary vectors, exactly 4 are not coprime:
  {1000,0111}: GCD(1000, 111) = 1;
  {1001,0110}: GCD(1001, 110) = 11;
  {1010,0101}: GCD(1010, 101) = 101;
  {1011,0100}: GCD(1011, 100) = 1;
  {1100,0011}: GCD(1100, 11) = 11;
  {1101,0010}: GCD(1101, 10) = 1;
  {1110,0001}: GCD(1101, 10) = 1;
  {1111,0000}: GCD(1111, 0) = 1111.
The pair {1100010011110, 0011101100001} is counted toward a(13) because in base 10, GCD(1100010011110, 11101100001) = 53. In total, there are 131 such pairs of length 13 that share common prime factors of either 53 or 79. This exemplifies the smallest prime n such that a(n) > 1.
a(317) = 1 because 317 is a term in A004023. Indeed, if any partition of the repunit R_317 into a sum of mutually complementary binary vectors except {R_317, 0} had a nontrivial common divisor q, then the repunit itself would be divisible by q < R_317, which contradicts the fact that R_317 is prime.
		

Crossrefs

Programs

  • Mathematica
    CountNonCoprimes10[n_] := (Repunit = (10^n - 1)/9; Result = 0; Do[If[!CoprimeQ[#, Repunit-#]
      &[FromDigits[IntegerDigits[i, 2]]], Result++], {i, 2^(n-1), 2^n-1}]; Result);
    Table[CountNonCoprimes10[n], {n, 0, 25}]
    (* Alternative version of the code that uses ParallelSum *)
    SubCountNonCoprimes10[n_, k_, totk_] := (Result = 0;  Do[If[!CoprimeQ[#, Repunit-#]
      &[FromDigits[IntegerDigits[i, 2]]], Result++], {i, #[[k]], #[[k+1]]-1}]
      &[Round[Subdivide[2^(n-1), 2^n, totk]]]; Result);
    CountNonCoprimes10[n_] := (Repunit = (10^n-1)/9; ParallelSum[SubCountNonCoprimes10[n, k, $KernelCount], {k, $KernelCount}, ProgressReporting -> False]);
    Table[CountNonCoprimes10[n], {n, 0, 25}]

Formula

a(n) <= A000325(n-1) = 2^(n-1) - n + 1;
a(A004023(n)) = 1.

A378199 Number of digit patterns of length n such that all integers of that digital type share a common prime factor of a different digital type.

Original entry on oeis.org

0, 0, 1, 4, 1, 26, 1, 175, 365, 1513, 1, 52611, 989, 426897, 3072870, 11132038, 1, 879525398, 316025138
Offset: 1

Views

Author

Dmytro Inosov, Nov 19 2024

Keywords

Comments

a(n) gives the number of distinct digit patterns (or digital types, as per A266946) such that all integers of that digital type share a common prime factor of a different digital type.
The number of remaining digit patterns not counted toward a(n) is given by A376918(n).
A particular digit pattern of length n is counted toward a(n) if it is not counted toward A376918(n).
All digital types counted toward a(n) result in composites for any values of the distinct digits in the pattern, without the need to run primality tests on all numbers of that digital type individually.
The requirement for a divisor of a different digital type only affects reprigits of the form AA..AA and acts to exclude that pattern iff the n-repunit is prime (n in A004023).
A164864(n) gives the total number of possible digit patterns of length n and is therefore an upper bound for a(n).
a(n) is nonmonotonic and takes on small values for prime n and large values for n with a large number of nontrivial divisors (A070824). This is a consequence of divisibility rules that are formulated for prime divisors of 10^r-1 or 10^r+1 (where r divides n) in terms of the sum or alternating sum of r-digit blocks, respectively [see S. Shirali, First Steps in Number Theory: A Primer on Divisibility, Universities Press, 2019, pp. 42-49].
a(n) coincides with row sums of T(n,k) in A378761 for n = 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15, 17, 18. - Dmytro Inosov, Dec 23 2024

Examples

			For n=2, there are only two possible digit patterns, "AA" and "AB". Neither of them is counted toward a(2) because the common prime factor of all integers with the pattern "AA" is 11, which is a prime repunit and is therefore of the same digital type "AA", whereas integers of the digital type "AB" have no common prime factors. Indeed, AB = 10*A + 1*B, and GCD(10,1)=1.
For n=3, the repdigit pattern "AAA" is counted toward a(3) because the repunit 111 is not a prime, hence all integers of the digital type "AAA" are divisible by prime factors of 111, which are 3 and 37, both of a different digital type from "AAA".
Counterexample: The digit pattern "ABA" is not counted toward a(3) because ABA = 101*A + 10*B, and since GCD(101,10) = 1, this digital type has no common prime factors.
The pattern "ABAB" is counted toward a(4) because it is divisible by 101 for any A > 0 and B >= 0, and 101 has a different digital type from ABAB. Indeed, ABAB = A*1010 + B*101, which is identically divisible by 101. In total there are four 4-digit patterns that are counted: ABBA, AABB, AAAA (all of them divisible by 11) and ABAB (divisible by 101). Therefore, a(4) = 4.
The pattern "ABCDEFGHIJ" that contains all possible digits exactly once is counted toward a(10) because its sum of digits is 1+2+...+9 = 45, which is divisible by 9. Therefore, all integers with the digital type "ABCDEFGHIJ" share the common prime factor 3.
		

Crossrefs

Programs

  • Mathematica
    MinLength = 1; MaxLength = 12; (* the range of n to calculate a(n) for *)
    (* Function that calculates the canonical form A358497(n) *)
    A358497[k_] := FromDigits@a358497C[k]
    a358497C = Compile[{{k, _Integer}}, Module[{firstpos = ConstantArray[0, 10],
      digits = IntegerDigits[k], indx = 0}, Table[If[firstpos[[digits[[j]] + 1]] == 0, firstpos[[digits[[j]] + 1]] = Mod[++indx,10]]; firstpos[[digits[[j]] + 1]], {j, Length[digits]}]]];
    (* Function that checks if a common prime factor of a different digital type exists *)
    DivisibilityRulesQ[pat_] := (
      If[Divisible[Length[pat], 10] && Length[Counts[pat]] == 10 &&
         AllTrue[Table[Counts[pat][[i]] == Length[pat]/10, {i, 1, 10}], TrueQ], Return[True]];
      (# != 1) && AnyTrue[Extract[# // FactorInteger, {All, 1}],
         A358497[#] != A358497[pat // FromDigits] &] &[
         Apply[GCD, Total[10^(Position[Reverse[pat], #]-1) // Flatten]& /@
         Mod[Range[CountDistinct[pat]], 10]]]);
    (* Function that generates all patterns that satisfy divisibility rules *)
    Patterns[len_, k_] := (
      Clear[dfs];
      ResultingPatterns = {};
      dfs[number_List] := If[Length[number] == len,
        If[Length[Union[If[# < 10, #, 0] & /@ number]] == k,
          AppendTo[ResultingPatterns, If[# < 10, #, 0] & /@ number]],
        Do[If[i <= 10, dfs[Append[number, i]]], {i, Range[1, Last[Union[number]] + 1]}]];
      dfs[{1}];
      FromDigits /@ Select[ResultingPatterns, DivisibilityRulesQ[#] &]);
    (* Counting the patterns with k distinct digits and their row sums a(n) *)
    Do[Print[{n, #, Sum[#[[m]], {m, 1, Length[#]}]}] &[Table[Length[Patterns[n, j]], {j, 1, Min[10, n]}]], {n, MinLength, MaxLength}];

Formula

a(n) = A164864(n) - A376918(n).
a(n) = A164864(n) - A267013(n) - A377727(n).
a(n) <= A164864(n).

Extensions

a(15)-a(19) from Dmytro Inosov, Dec 23 2024
Showing 1-4 of 4 results.