A069558
Triangular numbers in which the k-th digit, numbering them from right to left, either divides k or is a nonzero multiple of k. Is 1 only when k has no other single-digit divisor (less than 10).
Original entry on oeis.org
1, 3, 6, 21, 28, 45, 66, 325, 666, 946, 2346, 2628, 2926, 8385, 8646, 52326, 54946
Offset: 1
8646 is a term in which, numbering the digits from right to left,
the 1st digit is 6;
the 2nd digit is 4, a multiple of 2;
the 3rd digit is 6, a multiple of 3;
the 4th digit is 8, a multiple of 4.
A069560
Squares in which the k-th significant digit either divides k or is a multiple of k.
Original entry on oeis.org
1, 4, 9, 16, 25, 49, 64, 81, 121, 144, 169, 324, 361, 625, 961, 1369, 1681, 2116, 2916, 4624, 8649, 11664, 12321, 14161, 14641, 51984, 114921, 151321, 214369, 311364, 351649, 1151329, 1252161, 1658944, 7311616, 7354944, 41254929, 41654116
Offset: 1
8649 is a member in which the fourth digit is 8 a multiple of 4, the third one is 6 a multiple of 3, the second one is 4 a multiple of 2 and the least significant digit is 9.
-
isok(k)={my(d=digits(k)); for(i=1, #d, my(t=d[#d+1-i]); if(!t || (t%i && i%t), return(0))); 1}
for(k=1, 10000, my(x=k^2); if(isok(x), print1(x, ", "))) \\ Andrew Howroyd, Sep 19 2024
-
\\ faster program
B(k)={
local(L=List());
my(v=vector(k, i, select(t->t%i==0||i%t==0, [1..9])));
my(chk(d)=for(i=1, #d, if(!vecsearch(v[i], d[#d+1-i]), return(0)));1);
my(s=k\2, b=10^s);
my(recurse(i,m)=if(i==s,
for(j=sqrtint(m*b+b\10-1)+1, sqrtint(m*b+b-1), my(t=j^2); if(chk(digits(t%b)), listput(L,t))),
m*=10; foreach(v[i], t, self()(i-1, m+t))
));
recurse(k, 0);
Vec(L);
}
concat(vector(12,k,B(k))) \\ Andrew Howroyd, Sep 19 2024
Showing 1-2 of 2 results.
Comments