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.

User: Davis Smith

Davis Smith's wiki page.

Davis Smith has authored 27 sequences. Here are the ten most recent ones:

A362867 Irregular triangle read by rows; the n-th row is the n-th permutation of 0 to infinity, in reversed colexicographic ordering, terminating when the rest of the row equals k.

Original entry on oeis.org

0, 1, 0, 0, 2, 1, 2, 0, 1, 1, 2, 0, 2, 1, 0, 0, 1, 3, 2, 1, 0, 3, 2, 0, 3, 1, 2, 3, 0, 1, 2, 1, 3, 0, 2, 3, 1, 0, 2, 0, 2, 3, 1, 2, 0, 3, 1, 0, 3, 2, 1, 3, 0, 2, 1, 2, 3, 0, 1, 3, 2, 0, 1, 1, 2, 3, 0, 2, 1, 3, 0, 1, 3, 2, 0, 3, 1, 2, 0, 2, 3, 1, 0, 3, 2, 1, 0
Offset: 0

Author

Davis Smith, May 06 2023

Keywords

Comments

Every row of this triangle represents a number which is normal in base b >= 2. Since there are infinitely many bases, every row represents a set of infinitely many numbers, each of which is normal in at least one base.
Treating A(n,k) as equal to k when k is greater than A084558(n) (A084558(n) is the length of the n-th row minus one), for any base b >= 2, the concatenation of the base-b expansion of the n-th row is normal in base b. In other words, for any n >= 0 and b >= 2, C(n,b) is normal in base b.
C(n,b) = Sum_{k >= 0} A(n,k)/(b^(Sum_{m=0..k} ceiling(log_b(A(n,m)+1))))
(The equation for Champernowne's constants using the n-th row of this triangle rather than 0,1,2,...)
C(0,b) is Champernowne's constant for base b (C_b).
Even though for any b and m >= 2, b != m, C(n,b) != C(n,m), it is possible for C(n,b) = C(m,p) where n != m and b != p. In such a case, C(n,b) is normal in two different bases. m will likely be significantly larger than n and p will likely be a power of b.

Examples

			The irregular triangle begins (the numbers enclosed in square brackets are the continuation of the row):
n/k  0, 1, 2, 3, 4, 5, ...
0  | 0 [1, 2, 3, 4, 5, ...]
1  | 1, 0 [2, 3, 4, 5, ...]
2  | 0, 2, 1 [3, 4, 5, ...]
3  | 2, 0, 1 [3, 4, 5, ...]
4  | 1, 2, 0 [3, 4, 5, ...]
5  | 2, 1, 0 [3, 4, 5, ...]
6  | 0, 1, 3, 2 [4, 5, ...]
7  | 1, 0, 3, 2 [4, 5, ...]
8  | 0, 3, 1, 2 [4, 5, ...]
9  | 3, 0, 1, 2 [4, 5, ...]
10 | 1, 3, 0, 2 [4, 5, ...]
		

Crossrefs

Programs

  • PARI
    A362867_row(n)=my(N=n,m=0);while(N\=m++, );Vecrev(vecextract(abs([-(m-1)..0]),numtoperm(m,n)))

Formula

A(n,k) = A055089(n,k) - 1.

A353962 Square array read by descending antidiagonals: The n-th row gives the decimal expansion of the base-n Champernowne constant.

Original entry on oeis.org

8, 6, 5, 2, 9, 4, 2, 8, 2, 3, 4, 9, 6, 1, 2, 0, 5, 1, 0, 3, 1, 1, 8, 1, 7, 9, 9, 1, 2, 1, 1, 3, 8, 4, 6, 1, 5, 6, 1, 6, 6, 4, 3, 4, 1, 8, 7, 1, 1, 2, 3, 2, 0, 2, 1, 6, 5, 1, 1, 6, 5, 6, 6, 3, 0, 0, 8, 3, 1, 1, 8, 5, 4, 2, 4, 9, 9, 0, 0, 8, 1, 1, 5, 3, 8, 4, 5, 9, 9, 9, 0
Offset: 2

Author

Davis Smith, May 12 2022

Keywords

Comments

The base-n Champernowne constant (C_n) is normal in base n. A(n,k) is the (k+1)-th decimal digit of the fractional part of C_n.

Examples

			The square array A(n,k) begins:
  n/k | 0  1  2  3  4  5  6  7  8  9 10 11 ...
  ----+---------------------------------------
   2  | 8  6  2  2  4  0  1  2  5  8  6  8 ...
   3  | 5  9  8  9  5  8  1  6  7  5  3  8 ...
   4  | 4  2  6  1  1  1  1  1  1  1  1  1 ...
   5  | 3  1  0  7  3  6  1  1  1  1  1  1 ...
   6  | 2  3  9  8  6  2  6  8  5  8  1  5 ...
   7  | 1  9  4  4  3  5  5  3  5  0  8  6 ...
   8  | 1  6  3  2  6  4  8  1  2  1  0  5 ...
   9  | 1  4  0  6  2  4  9  7  6  1  1  9 ...
  10  | 1  2  3  4  5  6  7  8  9  1  0  1 ...
  ...
		

Crossrefs

Rows: A066716 (n=2), A077771 (n=3), A033307 (n=10).
Cf. A063945.

Programs

  • Mathematica
    A[n_,k_]:=Mod[Floor[ChampernowneNumber[n]10^(k + 1)] ,10]; Flatten[Table[Reverse[Table[A[n-k,k],{k,0,n-2}]],{n,2,14}]] (* Stefano Spezia, May 13 2022 *)

Formula

A(n,k) = floor(C_n*10^(k+1)) mod 10 where C_n (the base-n Champernowne constant) = Sum_{i>=1} i/(n^(i + Sum_{k=1..i-1} floor(log_n(k+1)))).

A353214 a(n) = 2^A007013(4) mod prime(n); the last term of this sequences is when a(n) = 1.

Original entry on oeis.org

0, -1, -2, 2, -4, -2, -8, 2, -5, -2, 4, -2, 5, 2, -11, -20, -22, 6, -23, -21, 2, -3, -16, -25, -31, 40, 19, -29, -2, -2, 2, -49, 19, 68, -56, -23, -59, 45, 29, -2, 62, 63, 27, 54, -2, -22, -46, 28, -85, -2, -29, 17, -113, -4, -128, -65, -46, 20, -51, -98, -64
Offset: 1

Author

Davis Smith, Apr 30 2022

Keywords

Comments

This sequence uses the centered version of mod. The residue system modulo prime(n) is {-1*floor(prime(n)/2)..floor(prime(n)/2)}. This is so that this sequence will encode information about the numbers around 2^A007013(4). If a(n) = k and prime(n) < 2^A007013(4) - k, then 2^A007013(4) - k is not prime (prime(n) is a factor of 2^A007013(4) - k). For example, a(22) = -3, so prime(22) = 79 is a factor of 2^A007013(4) + 3.
The length of this sequence is the lowest value of n such that A014664(n) = A007013(4). This is because for any power of 2, 2^p, if p == 0 (mod A014664(n)), then 2^p == 1 (mod prime(n)) (prime(n) is a factor of A000225(p)). Since A007013(4) is prime, we can apply this to get: If A014664(n) = A007013(4) and prime(n) < A007013(5), then A007013(5) is not prime (prime(n) is a nontrivial factor).
For any n such that prime(n) < 5*(10^51 + 5*10^9), a(n) != 1.

Crossrefs

Cf. A000225, A007013, A014664. Powers of 2 mod primes: A201908, A201912, A353171.

Programs

  • PARI
    A353214(n)=my(CM4=shift(1,127)-1);centerlift(Mod(2,prime(n))^CM4)

Formula

a(n) = 2^(2^127 - 1) mod prime(n).

A353171 Irregular triangle read by rows; T(n,k) = 2^k (mod prime(n)), terminating when T(n,k) = 1.

Original entry on oeis.org

-1, 1, 2, -1, -2, 1, 2, -3, 1, 2, 4, -3, 5, -1, -2, -4, 3, -5, 1, 2, 4, -5, 3, 6, -1, -2, -4, 5, -3, -6, 1, 2, 4, 8, -1, -2, -4, -8, 1, 2, 4, 8, -3, -6, 7, -5, 9, -1, -2, -4, -8, 3, 6, -7, 5, -9, 1, 2, 4, 8, -7, 9, -5, -10, 3, 6, -11, 1, 2, 4, 8, -13, 3, 6, 12, -5, -10, 9, -11, 7, 14, -1, -2, -4, -8, 13, -3, -6, -12, 5, 10, -9, 11, -7, -14, 1, 2, 4, 8, -15, 1
Offset: 2

Author

Davis Smith, Apr 28 2022

Keywords

Comments

Although the most significant digits of powers of 2 in base n are generally not periodic (the exception being when n is a power of 2), the least significant digits are. For example, 2 to an even power is congruent to 1 (mod 3) and 2 to an odd power is congruent to -1 (mod 3). This means that one can determine one of the prime factors of a Mersenne number, A000225, using the exponent. If n == 0 (mod 2), then A000225(n) == 0 (mod 3) (is a multiple of 3); if n == 0 (mod 4), then A000225(n) == 0 (mod 5); if n == 0 (mod 3), then A000225(n) == 0 (mod 7), and so on.
This general fact gives a reason for why certain Mersenne numbers are not prime (even with prime exponents). If p is congruent to 0 mod A014664(n) (the length of an n-th row) and prime(n) is less than the A000225(p), then prime(n) is a nontrivial factor of A000225(p).

Examples

			Irregular triangle begins
n/k||  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,  11, 12 ... || Length ||
----------------------------------------------------------------------
2  || -1   1                                              ||      2 ||
3  ||  2, -1, -2,  1                                      ||      4 ||
4  ||  2, -3,  1                                          ||      3 ||
5  ||  2,  4, -3,  5, -1, -2, -4,  3, -5,   1             ||     10 ||
6  ||  2,  4, -5,  3,  6, -1, -2, -4,  5,  -3, -6,  1     ||     12 ||
7  ||  2,  4,  8, -1, -2, -4, -8,  1                      ||      8 ||
		

Crossrefs

Cf. similar sequences: A201908, A201912.

Programs

  • PARI
    A353171_row(n)->my(N=centerlift(Mod(2,prime(n))^1),L=List(N),k=1);while(N!=1,k++;listput(L,N=centerlift(Mod(2,prime(n))^k)));Vec(L)

A352378 Irregular triangle read by rows: T(n,k) is the (n-th)-to-last digit of 2^p such that p == k + A123384(n-1) (mod A005054(n)); k >= 0.

Original entry on oeis.org

2, 4, 8, 6, 1, 3, 6, 2, 5, 1, 2, 4, 9, 9, 8, 6, 3, 7, 4, 8, 7, 5, 0, 0, 1, 2, 5, 0, 0, 0, 1, 3, 7, 5, 0, 1, 2, 5, 1, 3, 6, 2, 4, 8, 7, 4, 9, 8, 6, 2, 5, 1, 3, 7, 4, 9, 8, 7, 5, 1, 2, 4, 8, 6, 3, 6, 3, 6, 2, 4, 9, 9, 9, 9, 8, 7, 4, 9, 9, 9, 8, 6, 2, 4, 9, 8, 7, 4, 8, 6, 3, 7, 5, 1, 2, 5, 0, 1, 3, 7, 4, 8, 6, 2, 5, 0, 1
Offset: 1

Author

Davis Smith, Mar 14 2022

Keywords

Comments

The n-th row of this triangle is the cycle of the (n-th)-to-last digit of powers of 2.
The period of the last n digits of powers of 2 where the exponent is greater than or equal to n is A005054(n). As a result, this triangle can be used to get the (n-th)-to-last digit of a large power of 2; if p == k + A123384(n-1) (mod A005054(n)), then the (n-th)-to-last digit (base 10) of 2^p is T(n,k). For example, for n = 1, if p == 1 (mod 4), then 2^p == 2 (mod 10) and if p == 3 (mod 4), then 2^p == 8 (mod 10). For n = 2, if p == 4 (mod 20), then the second-to-last digit of 2^p (base 10) is 1 and if p == 7 (mod 20), then the second-to-last digit of 2^p (base 10) is 2.

Examples

			Irregular triangle begins:
n/k| 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... | Number of terms:
---+---------------------------------------+-----------------
1  | 2, 4, 8, 6;                           |                4
2  | 1, 3, 6, 2, 5, 1, 2, 4, 9, 9,  8, ... |               20
3  | 1, 2, 5, 0, 0, 0, 1, 3, 7, 5,  0, ... |              100
4  | 1, 2, 4, 8, 6, 2, 5, 1, 2, 4,  8, ... |              500
5  | 1, 3, 6, 3, 6, 2, 4, 9, 9, 8,  7, ... |             2500
6  | 1, 2, 5, 0, 0, 1, 3, 7, 5, 1,  2, ... |            12500
...
		

Crossrefs

The (n-th)-to-last digit of a power of 2: A000689 (n=1), A160590 (n=2).

Programs

  • PARI
    A352378_rows(n)=my(N=logint(10^(n-1),2),k=4*5^(n-1)); vector(k,v,floor(lift(Mod(2,10^n)^(v+N))/(10^(n-1))))

Formula

For n > 1, T(n,0) = 1.

A352301 a(n) is the n-th-to-last digit of A007013(n + 1).

Original entry on oeis.org

7, 2, 7, 3, 7, 6, 7, 5, 8, 2, 3, 6, 8, 0, 3, 0, 5, 1, 6, 0, 0, 4, 4, 2, 5, 3, 1, 0, 0, 0, 1, 8, 4, 2, 3, 1, 7, 2, 8, 6, 1, 9, 9, 0, 3, 6, 9, 7, 4, 1, 1, 9, 5, 4, 8, 7, 6, 7, 2, 2, 2, 7, 5, 7, 6, 5, 5, 6, 0, 0, 3, 9, 8, 7, 6, 3, 8, 2, 3, 4, 7, 2, 2, 4, 4, 7
Offset: 1

Author

Davis Smith, Mar 11 2022

Keywords

Comments

Although the sequences for the most significant digits of Mersenne numbers, A000225, are not cyclic (the most significant is not cyclic, the second most is not, etc.), the sequences for the least significant digits are. For example, if p == 3 (mod 4), then A000225(p) == 7 (mod 10). Since A007013(n + 1) = A000225(A007013(n)) and A007013(1) == 3 (mod 4), all subsequent values will be congruent to 7 (mod 10). Similarly, if p == 7 (mod 20), A000225(p) == 27 (mod 100). In general, if p == x (mod A005054(n)), then A000225(p) == A000225(x) (mod 10^n).
There are many primes of the form Sum_{i=1..n} a(i)*10^(i - 1). The largest known is for n = 7032 (it is 7032 digits long).

Crossrefs

Programs

  • PARI
    A352301_vec(n)=my(N=7,m=0);while(m
    				

Formula

a(n) = floor(A007013(n + 1)/(10^(n - 1))) (mod 10).
A007013(n + 1) == Sum_{i=1..n} a(i)*10^(i - 1) (mod 10^n).

A351289 Square array read by descending antidiagonals: A(n,k) is the smallest m such that the base-n expansion of m contains the base-n expansions of the k-th row of A048793 as substrings.

Original entry on oeis.org

1, 2, 1, 2, 2, 1, 3, 5, 2, 1, 3, 3, 6, 2, 1, 6, 3, 3, 7, 2, 1, 6, 11, 7, 3, 8, 2, 1, 4, 11, 11, 8, 3, 9, 2, 1, 4, 4, 27, 13, 9, 3, 10, 2, 1, 4, 4, 4, 38, 15, 10, 3, 11, 2, 1, 4, 14, 4, 4, 51, 17, 11, 3, 12, 2, 1, 12, 14, 18, 9, 4, 66, 19, 12, 3, 13, 2, 1, 12, 12, 18, 14, 10, 4, 83, 21, 13, 3, 14, 2, 1
Offset: 2

Author

Davis Smith, Feb 06 2022

Keywords

Comments

A(n,k) is the least m such that m contains the base-n expansions of the active bits (plus 1) in k as substrings.
The Shortest Superstring Problem is, given a set of strings, S, to find the shortest string which contains each element of S as a substring. All possible solutions to this problem are contained in this array. The values of k represent the set of strings (where the active bits represent the strings in base n). The value of k for non-numeral strings (or numeral strings with an initial 0) is generated by mapping each character to a unique value 1 through n, converting from base n+1, subtracting 1 from each, raising 2 to the power of each and then summing the result. A(n+1,k) in base n+1 is the shortest superstring. The value of k for numeral strings in base n (without initial 0's) is generated by just raising 2 to the power of the value of each and then summing the result. A(n,k) in base n is the shortest superstring.

Examples

			The binary expansion of 7 is 111. This means that the base-n expansions of the 7th column will contain the base-n expansions of 1, 2, and 3 as substrings. So A(6,7) = 123_6 (as that is the arrangement of those digits with the lowest value) and 123_6 = 51_10.
For another example, the binary expansion of 10 is 1010, so the 10th column will contain the base-n expansions of 2 and 4 as substrings. So A(7,10) = 24_7 (as that's the arrangement with the lowest value) and 24_7 = 18_10. Also, frequently, two or more of the substrings will overlap. For example, A(2,7) = 110_2 = 6 as the final digit of 11_2 is the same as the first digit of 10_2 and 1 is a substring of both of those.
The square array begins:
  n\k| 1   2   3   4   5   6   7   8   9  10 ...
  ===+==========================================
   2 | 1   2   2   3   3   6   6   4   4   4 ...
   3 | 1   2   5   3   3  11  11   4   4  14 ...
   4 | 1   2   6   3   7  11  27   4   4  18 ...
   5 | 1   2   7   3   8  13  38   4   9  14 ...
   6 | 1   2   8   3   9  15  51   4  10  16 ...
   7 | 1   2   9   3  10  17  66   4  11  18 ...
   8 | 1   2  10   3  11  19  83   4  12  20 ...
   9 | 1   2  11   3  12  21 102   4  13  22 ...
  10 | 1   2  12   3  13  23 123   4  14  24 ...
  11 | 1   2  13   3  14  25 146   4  15  26 ...
  ..
		

Programs

  • PARI
    A351289(n,k)=if(hammingweight(k)==1,return(logint(k,2)+1), my(OverSumBase(X)=fold((x,y)->my(B1=digits(x,n),B2=digits(y,n),b=select(z->B1[#B1-(z-1)..#B1]==B2[1..z],[1..min(#B1,#B2)]));fromdigits(concat(B1,B2[if(#b,vecmax(b)+1,1)..#B2]),n),Vec(X)), K=select(z->bittest(k,z-1),[1..logint(k,2)+1]), V=apply(x->my(X=if(x,digits(x,n),[0]));setbinop((y,z)->fromdigits(X[y..z],n),[1..#X]),K), W=select(X->my(L=List(V));listpop(L,setsearch(K,X));!setsearch(Set(concat(L)),X),K), P1); if(#W==1, return(W[1]), vecmax(K)P,P1=P),P1=P));print(P1);return(P1)))

Formula

A(n,2^k) = k + 1.
A(n,2^k - 1) = A350510(n,k).
A(2,2^k - 1) = A056744(k).
For n > A070939(k), A(n,k) = Sum_{i=1..A000120(k)} A048793(k,i)*n^(A000120(k) - i).

A350510 Square array read by descending antidiagonals: A(n,k) is the least number m such that the base-n expansion of m contains the base-n expansions of 1..k as substrings.

Original entry on oeis.org

1, 2, 1, 6, 5, 1, 12, 11, 6, 1, 44, 38, 27, 7, 1, 44, 95, 75, 38, 8, 1, 92, 285, 331, 194, 51, 9, 1, 184, 933, 1115, 694, 310, 66, 10, 1, 1208, 2805, 4455, 3819, 1865, 466, 83, 11, 1, 1256, 7179, 17799, 16444, 8345, 3267, 668, 102, 12, 1
Offset: 2

Author

Davis Smith, Jan 02 2022

Keywords

Examples

			Square array begins:
n/k|| 1 |  2 |   3 |    4 |     5 |      6 |       7 |        8 |
================================================================|
2  || 1 |  2 |   6 |   12 |    44 |     44 |      92 |      184 |
3  || 1 |  5 |  11 |   38 |    95 |    285 |     933 |     2805 |
4  || 1 |  6 |  27 |   75 |   331 |   1115 |    4455 |    17799 |
5  || 1 |  7 |  38 |  194 |   694 |   3819 |   16444 |    82169 |
6  || 1 |  8 |  51 |  310 |  1865 |   8345 |   55001 |   289577 |
7  || 1 |  9 |  66 |  466 |  3267 |  22875 |  123717 |   947260 |
8  || 1 | 10 |  83 |  668 |  5349 |  42798 |  342391 |  2177399 |
9  || 1 | 11 | 102 |  922 |  8303 |  74733 |  672604 |  6053444 |
10 || 1 | 12 | 123 | 1234 | 12345 | 123456 | 1234567 | 12345678 |
11 || 1 | 13 | 146 | 1610 | 17715 | 194871 | 2143588 | 23579476 |
		

Crossrefs

The first n - 1 terms of rows: 2: A047778, 3: A048435, 4: A048436, 5: A048437, 6: A048438, 7: A048439, 8: A048440, 9: A048441, 10: A007908, 11: A048442, 12: A048443, 13: A048444, 14: A048445, 15: A048446, 16: A048447.

Programs

  • Mathematica
    T[n_,k_]:=(m=0;While[!ContainsAll[Subsequences@IntegerDigits[++m,n],IntegerDigits[Range@k,n]]];m);Flatten@Table[T[1+i,j+1-i],{j,9},{i,j}] (* Giorgos Kalogeropoulos, Jan 09 2022 *)
  • PARI
    A350510_rows(n,k,N=0)= my(L=List(concat(apply(z->fromdigits([1..z],n),[1..n-1]),if(n>2,fromdigits(concat([1,0],[2..n-1]),n),[]))),T1(x)=digits(x,n),T2(x)=fromdigits(x,n),A(x)=my(S=T1(x));setbinop((y,z)->T2(S[y..z]),[1..#S]),N=if(N,N,L[#L]),A1=A(N));while(#Lsetsearch(A1,z),[1..#L+1])),A1=A(N++));listput(L,N));Vec(L)

Formula

For k < n, A(n,k) = A(n,k - 1)*n + k = Sum_{i=1..k} i*(n^(k - i)).
A(n,n) = A049363(n).
A(n,2) = A057544(n).
For n > 3, A(n,3) = A102305(n).
A(n,n - 1) = A023811(n).

A340566 Square array, read by descending antidiagonals; T(n,k) is A001057(n) + A001057(k)*i, converted to complex binary (base -1 + i), where i=sqrt(-1).

Original entry on oeis.org

0, 11, 1, 111, 1110, 11101, 1110100, 111010, 10, 1100, 100, 1110101, 110, 1111, 11100, 1110111, 101, 11001, 111011, 11111, 1101, 110011, 1010, 11101001, 1000, 11101011, 111010010, 10001, 1110000, 111110, 1110110, 111000, 11000, 111010110, 11110, 111010000
Offset: 0

Author

Davis Smith, Jan 11 2021

Keywords

Comments

Complex binary (base -1 + i) has the ability to express all positive or negative, real or complex, integers with only 2 numerical symbols ('0' and '1') as integers, without the need for a sign marking the integers as such.
Converting a real number, n, to complex binary requires one to convert it to base -4 ((n + N) xor N, N = floor(4/5*16^(ceiling(log_4(abs(n))) + 1))), then adding 10 to every digit greater than 1, then treating it as a number in base 16 and converting that to binary. (E.g., -5 => [2,3] => [12,13] => 205 => 11001101.)
Converting a complex number, n + k*i, requires one to convert X = n + k into complex binary and then convert k into the same but shift it one digit to the left. After this, one must add them together. This functions much the same way as binary addition, but the carry is '110' rather than '1' and 11 + 111 = 0.

Examples

			Square array T(n,k) begins:
  \k      0         1         2          3        4       5        6 ...
  n\
   0|     0        11       111    1110100      100 1110111   110011 ...
   1|     1      1110    111010    1110101      101    1010   111110 ...
   2| 11101        10       110      11001 11101001 1110110   110010 ...
   3|  1100      1111    111011       1000   111000    1011   111111 ...
   4| 11100     11111  11101011      11000 11101000   11011 11101111 ...
   5|  1101 111010010 111010110       1001   111001 1100110   100010 ...
   6| 10001     11110  11101010 1110100101    10101   11010 11101110 ...
		

References

  • T. Jamil, Complex Binary Number System, Springer, 2013.

Crossrefs

Programs

  • PARI
    A340566(n,k)={my(A001057(x)=if(x%2,x\2+1,-x/2),V=vecsum(Vec(matconcat(apply(w->my(Y=if(w,A001057(k), A001057(n)+A001057(k)));if(Y, my(X=floor(4^(2*logint(abs(Y), 4)+5)/5));Vecrev(binary(shift(fromdigits(apply(z->z+(10*(z>1)), digits(bitxor(Y+X,X),4)),16),w)))),[0,1])~)~))~);
    while(vecmax(V)>1,my(Z=Vec(select(x->x>1,V,1)));for(x=1,#Z,my(z=Z[x]);if(V[z]<=1,,(z+2<=#V)&&(V[z+1]>1)&&V[z+2],for(j=z,z+2,V[j]-=2^(j!=(z+2))),(z+4<=#V)&&vecmin(V[z+2..z+4]),V[z]-=2;for(j=z+2,z+4,V[j]-=1),z+1>#V,V[z]-=2;V=concat(V,[0,1,1]),V[z]-=2;for(j=z+2,z+3,if(j<=#V,V[j]+=1,V=concat(V,1))))));fromdigits(Vecrev(V))}
    
  • PARI
    { T(n,k) = my(z=n\/2*-(-1)^n + k\/2*-(-1)^k*I, ret=List([]));
      while(z, my(bit=(real(z)+imag(z))%2);
        listput(ret,bit); z=(z-bit)/(I-1));
      fromdigits(Vecrev(ret)); } \\ Kevin Ryde, Jan 12 2021

A332084 Triangle read by rows: T(n,k) is the smallest m >= 0 such that floor(Pi*n^m) == k (mod n), -1 if one does not exist, k = 0..n-1.

Original entry on oeis.org

0, 1, 0, 0, 2, 4, 1, 3, 2, 0, 1, 7, 3, 0, 8, 1, 9, 14, 0, 10, 2, 1, 7, 10, 0, 8, 6, 2, 3, 1, 8, 0, 9, 6, 14, 5, 10, 1, 2, 0, 3, 20, 18, 11, 5, 32, 1, 6, 0, 2, 4, 7, 13, 11, 5, 5, 1, 8, 0, 13, 4, 2, 6, 9, 24, 12, 5, 1, 22, 0, 3, 17, 14, 18, 2, 6, 20, 10, 5, 1, 10, 0, 6, 9, 17, 14, 23, 7, 2, 21, 3
Offset: 1

Author

Davis Smith, Aug 22 2020

Keywords

Comments

Pi is normal in base n >= 2 if and only if in every row N, such that N is a power of n, -1 does not appear. Pi is absolutely normal if and only if -1 never appears.
Conjecture: Pi is absolutely normal, meaning that -1 will never appear.
This triangle is an instance of the more general f(n,k,r), where f(n,k,r) is the smallest m >= 0 such that floor(r*n^m) == k (mod n) (-1 if one does not exist) and r is irrational. The same conditions for normalcy apply.

Examples

			The triangle T(n,k) starts:
n\k   0   1   2   3   4   5   6   7   8   9  10  11  12 ...
1:    0
2:    1   0
3:    0   2   4
4:    1   3   2   0
5:    1   7   3   0   8
6:    1   9  14   0  10   2
7:    1   7  10   0   8   6   2
8:    3   1   8   0   9   6  14   5
9:   10   1   2   0   3  20  18  11   5
10:  32   1   6   0   2   4   7  13  11   5
11:   5   1  22   0  13   4   2   6   9  24  12
12:   5   1  10   0   3  17  14  18   2   6  20  10
13:   5   1  10   0   6   9  17  14  23   7   2  21   3
		

Crossrefs

Positions of 0 through 9 in base 10: A037000, A037001, A037002, A037003, A037004, A037005, A036974, A037006, A037007, A037008.

Programs

  • PARI
    A332084_row(n)={my(L=List(vector(n,z,-1)), m=-1); while(vecmin(Vec(L))==-1, my(Z=lift(Mod(floor(Pi*n^(m++)),n))+1); if(L[Z]<0,listput(L,m,Z))); Vec(L)}

Formula

T(n,3) = 0, n > 3.