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-10 of 11 results. Next

A358615 Record high values in A358497.

Original entry on oeis.org

1, 12, 122, 123, 1222, 1223, 1232, 1233, 1234, 12222, 12223, 12232, 12233, 12234, 12322, 12323, 12324, 12332, 12333, 12334, 12342, 12343, 12344, 12345, 122222, 122223, 122232, 122233, 122234, 122322, 122323, 122324, 122332, 122333, 122334, 122342, 122343, 122344
Offset: 1

Views

Author

Gleb Ivanov, Nov 23 2022

Keywords

Crossrefs

Programs

  • Python
    def A358497(n):
        d, s, k = dict(), str(n), 1
        for i in range(len(s)):
            if d.get(s[i], 0) == 0:
                d[s[i]] = str(k)
                k = (k + 1)%10
        s_t = list(s)
        for i in range(len(s)):s_t[i] = d[s[i]]
        return int(''.join(s_t))
    terms = [1,]
    for i in range(1, 10**6):
        if A358497(i)>terms[-1]:terms.append(A358497(i))
    print(terms)

A266946 Smallest number of each digital type.

Original entry on oeis.org

1, 10, 11, 100, 101, 102, 110, 111, 1000, 1001, 1002, 1010, 1011, 1012, 1020, 1021, 1022, 1023, 1100, 1101, 1102, 1110, 1111, 10000, 10001, 10002, 10010, 10011, 10012, 10020, 10021, 10022, 10023, 10100, 10101, 10102, 10110, 10111, 10112, 10120, 10121, 10122, 10123, 10200, 10201, 10202, 10203, 10210, 10211, 10212, 10213, 10220, 10221, 10222, 10223, 10230, 10231, 10232, 10233, 10234, 11000, 11001, 11002, 11010, 11011, 11012, 11020, 11021, 11022, 11023, 11100, 11101, 11102, 11110, 11111
Offset: 1

Views

Author

Vladimir Shevelev, Jan 06 2016

Keywords

Comments

The smallest single-digit positive number is 1. This is the first type.
The smallest of the two-digit positive numbers with distinct digits is 10. This is the second type. The smallest of two-digit positive numbers with equal digits is 11. This is the third type, etc.
A digital type is an equivalence class of integers that share the same pattern of identical digits. a(n) defines a possible canonical form for this equivalence relation. It can be obtained from the distinct terms in A358497 after the following digit replacement: {1->1, 2->0, 3->2, 4->3, 5->4, 6->5, 7->6, 8->7, 9->8, 0->9}. - Dmytro Inosov, Nov 14 2024

Examples

			The first 3-digit number is 100 = a(4).
The following number is 101. It does not belong to the type 100, since the first and the third digits coincide in 101, while in 100 they do not. So 101 is a new type, and a(5)=101.
Next consider 102. Here there are 3 distinct digits, so 102 is a new type, and a(6)=102. However, 103, 104, 105, 106, 107, 108, 109 also have 3 distinct digits, i.e., they belong to type 102.
Further, 110 belongs to neither type 100 nor type 101, since in 110 the first and the second digits coincide, while not in 100 and 101, so a(7)=110; also 111 is a new type, where all digits coincide.
Now we see that every 3-digit number is of one of the 5 types a(4), a(5), a(6), a(7), a(8).
Next we consider the first 4-digit number a(9)=1000, etc.
		

Crossrefs

Formula

The number of distinct types of k-digit numbers equals A164864(k).

Extensions

More terms from Peter J. C. Moses, Jan 06 2016

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

A378154 Array read by rows: T(n,k) for k <= min(n,10) is the number of digital types of length n with exactly k distinct decimal digits without common prime factors of a different digital type.

Original entry on oeis.org

1, 1, 1, 0, 3, 1, 0, 4, 6, 1, 0, 15, 25, 10, 1, 0, 12, 84, 65, 15, 1, 0, 63, 301, 350, 140, 21, 1, 0, 80, 868, 1672, 1050, 266, 28, 1, 0, 171, 2745, 7770, 6951, 2646, 462, 36, 1, 0, 370, 8680, 33505, 42405, 22827, 5880, 750, 45, 0, 0, 1023, 28501, 145750, 246730, 179487, 63987, 11880, 1155, 55
Offset: 1

Views

Author

Dmytro Inosov, Nov 18 2024

Keywords

Comments

T(n,k) is defined as the number of distinct digit patterns (or digital types, as per A266946) of length n with k distinct digits such that all integers of that digital type share no common prime factor of a different digital type (as per A376918). Terms with k > n are omitted as trivial zeros.
To check whether a digit pattern of length n with k distinct digits A,B,... should be counted toward T(n,k), 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 T(n,k). Otherwise, it is excluded.
For k = 10, the sum of all distinct digits A + B + ... + J = 45, which is divisible by 9. Hence, patterns in which all 10 distinct digits from A to J have the same number of occurrences in the pattern modulo 3 are identically divisible by 3 and should be excluded. This has an effect on T(n,10) whenever n takes the form 10m + 3q (with m >= 1 and q >= 0).
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 terms with k=1, i.e. repdigits AA..AA, and acts to include that pattern iff the n-repunit is prime (n in A004023).
T(n,k) gives an upper bound for the number of contributions to A267013(n) with exactly k distinct digits.
Stirling numbers of the second kind S2(n,k) (A008277) give the total number of possible digital types of length n with k distinct digits and are therefore an upper bound for T(n,k).
T(n,1)=1 either when n=1 or when n is a term in A004023 (indices of prime repunits); otherwise T(n,1)=0 because all the repdigits A*(10^n-1)/9 are simultaneously divisibly by any proper divisor of the repunit (10^n-1)/9.
T(n,2) is nonmonotonic because a larger number of digit patterns is excluded whenever n has a large number of nontrivial divisors (A070824), resulting in anomalously low values, for example, for n=12 or n=18. 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].

Examples

			T(n,k) as a table (omitting terms with k > n):
---------------------------------------------------------------------------------------------
 k:  1,    2,      3,       4,       5,       6,       7,       8,      9,    10; | Total,
 n |                                                                              | A376918(n)
---------------------------------------------------------------------------------------------
 1 | 1;                                                                           |        1
 2 | 1,    1;                                                                     |        2
 3 | 0,    3,      1;                                                             |        4
 4 | 0,    4,      6,       1;                                                    |       11
 5 | 0,   15,     25,      10,       1;                                           |       51
 6 | 0,   12,     84,      65,      15,       1;                                  |      177
 7 | 0,   63,    301,     350,     140,      21,       1;                         |      876
 8 | 0,   80,    868,    1672,    1050,     266,      28,       1;                |     3965
 9 | 0,  171,   2745,    7770,    6951,    2646,     462,      36,      1;        |    20782
10 | 0,  370,   8680,   33505,   42405,   22827,    5880,     750,     45,     0; |   114462
11 | 0, 1023,  28501,  145750,  246730,  179487,   63987,   11880,   1155,    55; |   678568
12 | 0,  912,  69792,  583438, 1373478, 1322896,  627396,  159027,  22275,  1705; |  4160919
13 | 0, 3965, 261495, 2532517, 7508501, 9321312, 5715424, 1899612, 359502, 38610; | 27640938
... (for more terms, see the A-file).
The pattern "ABCA" is counted toward T(4,3) 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 T(2,1) 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. Since no other patterns with n=2 and k=1 exist, T(2,1)=1.
The pattern "ABAB" is not counted toward T(4,2) 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. Since there are two more patterns "ABBA" and "AABB" that are excluded due to divisibility by 11, T(4,1) = S2(4,2) - 3 = 4.
The pattern "ABCDEFGHIJ" that contains all possible digits exactly once does not contribute to T(10,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. Since no other patterns with n=k=10 exist, T(10,10)=0.
The pattern "ABCBDEFBGHIBJ" is not counted toward T(13,10) because its sum of digits is 3*B+45, which is divisible by 3. In total there are binomial(13,4) = 715 patterns of length 13 with all 10 distinct digits in which any 4 digits are equal, and since A378761(13,10) = 0, we obtain T(13,10) = S2(13,10) - 715.
		

Crossrefs

Programs

  • Mathematica
    MinLength = 1; MaxLength = 10; (* the range of n to calculate T(n,k) 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) and their sum, A376918(n) *)
    Do[Print[{n, #, Sum[#[[m]], {m, 1, Length[#]}]}] &[Table[Length[Patterns[n, j]], {j, 1, Min[10, n]}]], {n, MinLength, MaxLength}];

Formula

Sum_{k=1..min(n,10)} T(n,k) = A376918(n) (row sums).
T(n+1,n) = A000217(n) for n <= 10.
T(n,2) = 2^(n-1) - A378511(n) for n > 1.
T(n,k) <= S2(n,k) -- k'th column of A008277.
T(n,k) = S2(n,k) - A378761(n,k) for 2 <= k <= 9.
T(n,k) = S2(n,k) for n/2 < k <= 9.
T(n,k) = S2(n,k) for 2 <= k <= 9 if A378511(n) = 1 (see A378761).
T(n,10) = S2(n,10) for n = 11, 12, 14, 15, 17, 18 -- the only integers >= 10 for which no representation n = 10m + 3q with m >= 1 and q >= 0 exists and A378761(n,10)=0.
T(13,10) = S2(13,10) - binomial(13,4).
T(16,10) = S2(16,10) - binomial(16,7) - binomial(16,4)*binomial(12,4)/2.
T(19,10) = S2(19,10) - binomial(19,10) - binomial(19,7)*binomial(12,4) - binomial(19,4)*binomial(15,4)*binomial(11,4)/6.
T(23,10) = S2(23,10) - binomial(23,5)*Product_{i=1..8}(2n+1) -- since A378761(23,10)=0.

A374238 Primes whose pattern of identical digits is unique among the primes.

Original entry on oeis.org

11, 3333311, 7771717, 11818181, 515115551, 727722727, 887887787, 1110011101, 1161611161, 1411111441, 1411141411, 1717117117, 1911999919, 3311113111, 3313133311, 3333353533, 5151111551, 5555115151, 5777777557, 7373733337, 7747447777, 7777111777, 8887788787, 9199119991, 9994449499
Offset: 1

Views

Author

Dmytro Inosov, Jul 01 2024

Keywords

Comments

The digit pattern for any natural number n is uniquely defined by the canonical form A358497(n), which enumerates digits according to their position of first occurrence. Each prime in this sequence has a unique digit pattern in the sense that no other prime has the same pattern.
Prime repunits (A004022) are a subsequence, as they are the sole primes with a single distinct digit.
A cryptarithm (alphametic) expresses a digit pattern in letters, where each distinct letter is to map to a distinct digit.
If a cryptarithmetic problem calls for a prime number, then the primes in this sequence are unique solutions, so we call these primes cryptarithmically unique.
The smallest term with 3 distinct digits is 1151135331533311.
The number of terms of length n is given by A376084(n).

Examples

			11 is a term since no other prime has the same pattern "AA" of two identical digits (any other AA is divisible by A > 1, hence nonprime).
Counterexample: 13 is not a term since another prime 17 has the same pattern "AB" of two nonidentical digits.
7771717 is a term since it's prime and no other prime has the same pattern "AAABABA".
		

Crossrefs

Cf. A000040 (primes), A004022 (prime repunits), A358497, A039986, A376918, A376084, A376118.

Programs

  • Mathematica
    NumOfDigits = 10; (*Maximal integer length to be searched for*)
    A358497[k_] :=
      FromDigits[
       Table[Mod[
         CountDistinct[Take[#, FirstPosition[#, #[[i]]][[1]]]] &[
          IntegerDigits[k]], 10], {i, 1, IntegerLength[k]}]];
    A006880[MaxLen_] := PrimePi[10^MaxLen];
    Extract[Select[
       Tally[Table[{#, A358497[#]} &[Prime[i]], {i, 1,
           A006880[NumOfDigits]}], #1[[2]] == #2[[2]] &], #[[2]] == 1 &], {All, 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

A376118 Cryptarithmically unique palindromic primes.

Original entry on oeis.org

11, 11141414111, 11999199911, 13111311131, 1110110110111, 1141411141411, 1611116111161, 3113113113113, 3222223222223, 3533355533353, 7444477744447, 7767777777677, 7887787877887, 7999979799997, 9494994994949, 9779999999779, 118818181818811, 131133131331131, 944499494994449, 10000010101000001
Offset: 1

Views

Author

Dmytro Inosov, Sep 11 2024

Keywords

Comments

Each prime in this sequence is simultaneously a palindrome in base 10 and has a unique decimal digit pattern A358497(a(n)) in the sense that no other prime has the same pattern.
All terms except 11 have an odd number of digits (cf. A002385).
Number of terms < 100^k: 1, 1, 1, 1, 1, 4, 16, 19, (92), (249), (416), (1093)... . The numbers in brackets are conjectured based on the calculated terms with 1, 2, or 3 distinct digits and the vanishing combinatorial probability of terms with 4 or more distinct digits at these lengths.
The smallest term with 3 distinct digits is 11155511521212511555111.

Examples

			11141414111 is a term since it's a palindromic prime and no other prime has the same pattern "AAABABABAAA" of repeating digits.
Counterexample: the palindromic prime 131 is not a term since another prime 151 has the same pattern "ABA" of repeating digits.
		

Crossrefs

Intersection of A374238 and A002113.
Subsequence of A002385.
Supersequence of A004022 (prime repunits).
Cf. A358497.

Programs

  • Mathematica
    NumOfDigits = 13; (* Maximal integer length to be searched for *)
    (* A 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]}]]];
    (* Extracting cryptarithmically uniqie terms from palindromic primes *)
    UniquePalPrimes = {11};
    Do[PalindromicPrimes = {}; CryptUnique = {};
      Do[If[PrimeQ[#], AppendTo[PalindromicPrimes,{#, A358497[#]}]]&[n*10^(IntegerLength[n]-1) +
         FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(k-1), 10^k-1}];
      CryptUnique = Extract[Extract[Select[Tally[PalindromicPrimes, #1[[2]]==#2[[2]] &], #[[2]]==1 &], {All,1}], {All,1}];
      UniquePalPrimes = Join[UniquePalPrimes, CryptUnique];
      (* Prints the number of results and the list of results for every integer length *)
      Print[{2k-1, Length[CryptUnique], CryptUnique}], {k, 2, (NumOfDigits+1)/2}];
    UniquePalPrimes

A373696 a(n) is the least m >= 0 with the same number of digits as n such that for some permutation p of 0..9, applying p to the digits of n yields the digits of m.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10
Offset: 0

Views

Author

Rémy Sigrist, Aug 04 2024

Keywords

Comments

Leading zeros are ignored.
For n > 0, a(n) is the least m > 0 such that A358497(n) = A358497(m).
All positive terms belong to A266946.

Examples

			For n = 65507668: the different digits appearing in 65507668 are 6, 5, 0, 7 and 8; so we replace 6's by 1's, 5's by 0's, 0's by 2's, 7's by 3's and 8's by 4's, and a(65507668) = 10023114.
		

Crossrefs

Cf. A137564, A266946, A358497, A373712 (ternary analog).

Programs

  • PARI
    a(n, base = 10) = { my (d = digits(n, base), m = vector(base, i, -1), u = 1); for (i = 1, #d, if (m[1+d[i]] < 0, m[1+d[i]] = u; u = if (u==1, 0, u==0, 2, u+1);); d[i] = m[1+d[i]];); fromdigits(d, base); }

Formula

a(n) <= n with equality iff n = 0 or n belongs to A266946.
a(a(n)) = a(n).

A374267 Perfect squares whose pattern of identical digits is unique among the squares.

Original entry on oeis.org

1444, 7744, 14884, 19881, 29929, 37636, 40401, 44944, 46656, 55696, 66564, 69696, 116964, 133225, 136161, 144400, 166464, 190969, 202500, 219961, 224676, 225625, 261121, 276676, 277729, 300304, 339889, 407044, 438244, 473344, 511225, 525625, 544644, 553536, 555025, 556516, 585225
Offset: 1

Views

Author

Dmytro Inosov, Jul 02 2024

Keywords

Comments

The digit pattern for any natural number n is uniquely defined by the canonical form A358497(n), which enumerates digits in order of their first occurrence in n, from left to right.
Each perfect square in this sequence has a unique digit pattern in the sense that no other square has the same pattern.
A cryptarithm (alphametic) expresses a digit pattern in letters, where each distinct letter is to map to a distinct digit.If a cryptarithmetic problem calls for a perfect square, then the squares in this sequence are unique solutions, so we call them cryptarithmically unique.

Examples

			The first cryptarithmically unique square is 38^2=1444. This means that no other square has the same digit pattern "ABBB".
Counterexample: 144=12^2 is not in this sequence because 400=20^2 is also a perfect square with the same digit pattern "ABB". Equivalently, A358497(144)=A358497(400)=122.
The alphametic puzzle SEA^2 = BIKINI has a solution 437^2 = 190969 (K=0, B=1, E=3, S=4, N=6, A=7, I=9). This solution is unique because 190969 is a term in this sequence.
		

Crossrefs

Subsequence of A000290 (squares).
Cf. A374268 (bases of cryptarithmically unique squares).
Cf. A374238 (cryptarithmically unique primes).

Programs

  • Mathematica
    NumOfDigits = 4; (* Maximal integer length to be searched for *)
    A358497[k_] := With[{pI = Values@PositionIndex@IntegerDigits@k}, MapIndexed[#1 -> Mod[#2[[1]], 10] &, pI, {2}] // Flatten // SparseArray // FromDigits];
    Extract[Extract[Select[Tally[Table[{#, A358497[#]} &[i^2], {i, 1, 10^NumOfDigits - 1}], #1[[2]] == #2[[2]] &], #[[2]] == 1 &], {All, 1}], {All, 1}]

Formula

a(n) = A374268(n)^2.

A374268 Numbers whose squares have a unique pattern of identical digits among the squares.

Original entry on oeis.org

38, 88, 122, 141, 173, 194, 201, 212, 216, 236, 258, 264, 342, 365, 369, 380, 408, 437, 450, 469, 474, 475, 511, 526, 527, 548, 583, 638, 662, 688, 715, 725, 738, 744, 745, 746, 765, 796, 804, 813, 816, 836, 880, 893, 898, 908, 970, 995, 1020
Offset: 1

Views

Author

Dmytro Inosov, Jul 02 2024

Keywords

Comments

The digit pattern for any natural number n is uniquely defined by the canonical form A358497(n), which enumerates digits in order of their first occurrence in n, from left to right.
The square of each term in this sequence has a unique digit pattern in the sense that no other square has the same pattern.
A cryptarithm (alphametic) expresses a digit pattern in letters, where each distinct letter is to map to a distinct digit.
If a cryptarithmetic problem calls for a perfect square, then the squares of numbers in this sequence are unique solutions, so we call them cryptarithmically unique.

Examples

			The first term of this sequence is 38, because the first cryptarithmically unique square is 38^2=1444. This means that no other square shares the same pattern "ABBB" of repeating digits.
Counterexample: 12 is not in this sequence because 12^2=144 has the same pattern "ABB" of repeating digits as 400=20^2. Equivalently, A358497(144)=A358497(400)=122.
The alphametic puzzle SEA^2 = BIKINI has a solution 437^2 = 190969 (K=0, B=1, E=3, S=4, N=6, A=7, I=9). This solution is unique because 437 is a term in this sequence.
		

Crossrefs

Cf. A374267 (cryptarithmically unique squares).

Programs

  • Mathematica
    NumOfDigits = 4; (*Maximal integer length to be searched for*)
    A358497[k_] := With[{pI = Values@PositionIndex@IntegerDigits@k}, MapIndexed[#1 -> Mod[#2[[1]], 10] &, pI, {2}] // Flatten // SparseArray // FromDigits];
    Extract[Extract[Select[Tally[Table[{i, A358497[i^2]}, {i, 1, 10^NumOfDigits - 1}], #1[[2]] == #2[[2]] &], #[[2]] == 1 &], {All, 1}], {All, 1}]

Formula

a(n) = sqrt(A374267(n)).
Showing 1-10 of 11 results. Next