login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Irregular triangle T(n,k) read by rows of residue classes of powers of 10 modulo n.
1

%I #14 Mar 25 2022 14:05:32

%S 0,1,0,1,1,2,0,1,0,1,4,1,3,2,6,4,5,1,2,4,0,1,1,0,1,10,1,10,4,1,10,9,

%T 12,3,4,1,10,2,6,4,12,8,1,10,1,10,4,8,0,1,10,15,14,4,6,9,5,16,7,2,3,

%U 13,11,8,12,1,10,1,10,5,12,6,3,11,15,17,18,9,14,7,13,16,8,4,2

%N Irregular triangle T(n,k) read by rows of residue classes of powers of 10 modulo n.

%C The length of the nonperiodic part of the residue class values is given in A051628, the length of the periodic part is given in A007732.

%C These residue class values are useful to check the divisibility of a number by the divisor n simply by calculating the weighted sum of digits. For example, the number 86415 is divisible by 7, because the weighted sum of digits 5*1 + 1*3 + 4*2 + 6*6 + 8*4 = 84 is divisible by 7. The used weights are the residue class values for n = 7: 1, 3, 2, 6, 4, 5, ... for ones, tens, hundreds, ...

%H Alois P. Heinz, <a href="/A276981/b276981.txt">Rows n = 1..800, flattened</a>

%e T(n,k), 1 <= k <= A051628(n) + A007732(n), starts with

%e n = 1: 0

%e n = 2: 1, 0

%e n = 3: 1

%e n = 4: 1, 2, 0

%e n = 5: 1, 0

%e n = 6: 1, 4

%e n = 7: 1, 3, 2, 6, 4, 5

%e n = 8: 1, 2, 4, 0

%e n = 9: 1

%e n = 10: 1, 0

%e n = 11: 1, 10

%e n = 12: 1, 10, 4

%e etc.

%p a:=proc(n)

%p local R,N,P,i;

%p R:=[seq(10^k mod n,k=0..n)]; # residue class

%p N:=[]; # nonperiodic part

%p P:=[]; # periodic part

%p for i from 1 to nops(R) do

%p member(R[i],R,'m');

%p if m<i then

%p if R[i]=1 then

%p P:=R[1..i-1];

%p else

%p N:=R[1..m-1];

%p P:=R[m..i-1];

%p fi;

%p break;

%p fi;

%p od;

%p return(op(N),op(P));

%p end:

%p seq(a(n),n=1..19);

%Y Cf. A007732, A051628.

%K nonn,base,tabf

%O 1,6

%A _Martin Renner_, Apr 11 2017