login
A354078
Squares k that are not divisible by 10, and whose reverse and digit sum are also squares, such that the digit sum divides both k and its reverse.
1
1, 4, 9, 144, 441, 10404, 12321, 40401, 69696, 1004004, 1022121, 1212201, 4004001, 4088484, 4848804, 100040004, 100220121, 102030201, 121022001, 400040001, 400880484, 404492544, 420578064, 445294404, 460875024, 484088004, 617323716, 10000400004, 10002200121
OFFSET
1,2
COMMENTS
Palindromic terms include 12321, 69696, 102030201, 617323716.
144, 10404, 1004004, 100040004, 10000400004, 1000004000004, ... are all terms, so the sequence is infinite.
From Jon E. Schoenfield, May 20 2022: (Start)
Among the 3358 terms < 10^21, several classes of terms are rare or nonexistent:
- no term has an even number of digits
- no term begins or ends with a 5
- no term begins with 18 or 92
- no term that begins with 16 has any digit other than 9 as its third digit
- only one term (420578064) begins with 42, and only one (460875024) begins with 46
- only one term (9488660854689) begins with 94, and only one (9864580668849) begins with 98
- only two terms begin or end with a 6: 69696 and 617323716 (each of which is a palindrome)
- only three terms begin with a 9 and end with anything other than a 1: 9, 9488660854689, and 9864580668849
Do there exist any terms > 10^21 of any of these classes?
(End)
EXAMPLE
10404 and its reverse, 40401 are terms because both are squares,
10404 = 102^2 and 40401 = 201^2, both have digit sum 9 and digit sum divides both 10404 and its reverse. 10404/9 = 1156, and 40401/9 = 4489.
PROG
(C)
int get_digit_sum(int integer, int *reverse)
{
int sum = 0;
int rev_num = 0;
int num = integer;
int rem = 0;
while (num != 0) {
rem = num % 10;
sum += rem;
num = num / 10;
rev_num = 10*rev_num + rem;
}
*reverse = rev_num;
return sum;
}
int is_square(int integer)
{
int mid = (int)(sqrt(integer));
if ((mid*mid) == integer) {
return mid;
}
else {
return 0;
}
}
int main(int argc, char *argv[])
{
int reverse = 0;
for (int j = 1; j <= 100011; j++) {
if (j % 10 == 0) {
continue;
}
int i = j*j;
int digit_sum = get_digit_sum(i, &reverse);
if ((i % digit_sum == 0) && (reverse % digit_sum == 0) &&
(is_square(digit_sum) != 0) && (is_square(reverse) != 0)) {
printf("%d, ", i);
}
}
printf("\n");
return 0;
}
(PARI) isok1(k) = if (k % 100, my(s=sumdigits(k), q=k/s); issquare(s) && issquare(q) && (denominator(q)==1));
isok(k) = isok1(k) && isok1(fromdigits(Vecrev(digits(k)))); \\ Michel Marcus, May 17 2022
(Magma) J:=100011; a:=[]; for j in [1..J] do if j mod 10 ne 0 then k:=j^2; I:=Intseq(k); s:=&+I; if (k mod s eq 0) and IsSquare(s) then r:=Seqint(Reverse(I)); if (r mod s eq 0) and IsSquare(r) then a[#a+1]:=k; end if; end if; end if; end for; a; // Jon E. Schoenfield, May 19 2022
CROSSREFS
Subsequence of A061457.
Sequence in context: A027451 A227744 A035127 * A061267 A061269 A061271
KEYWORD
nonn,base
AUTHOR
STATUS
approved