login
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

%I #68 May 21 2022 14:52:57

%S 1,4,9,144,441,10404,12321,40401,69696,1004004,1022121,1212201,

%T 4004001,4088484,4848804,100040004,100220121,102030201,121022001,

%U 400040001,400880484,404492544,420578064,445294404,460875024,484088004,617323716,10000400004,10002200121

%N 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.

%C Palindromic terms include 12321, 69696, 102030201, 617323716.

%C 144, 10404, 1004004, 100040004, 10000400004, 1000004000004, ... are all terms, so the sequence is infinite.

%C From _Jon E. Schoenfield_, May 20 2022: (Start)

%C Among the 3358 terms < 10^21, several classes of terms are rare or nonexistent:

%C - no term has an even number of digits

%C - no term begins or ends with a 5

%C - no term begins with 18 or 92

%C - no term that begins with 16 has any digit other than 9 as its third digit

%C - only one term (420578064) begins with 42, and only one (460875024) begins with 46

%C - only one term (9488660854689) begins with 94, and only one (9864580668849) begins with 98

%C - only two terms begin or end with a 6: 69696 and 617323716 (each of which is a palindrome)

%C - only three terms begin with a 9 and end with anything other than a 1: 9, 9488660854689, and 9864580668849

%C Do there exist any terms > 10^21 of any of these classes?

%C (End)

%H Jon E. Schoenfield, <a href="/A354078/b354078.txt">Table of n, a(n) for n = 1..3358</a>

%H <a href="/index/Sq#sqrev">Index entry for sequences related to reversing digits of squares</a>

%e 10404 and its reverse, 40401 are terms because both are squares,

%e 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.

%o (C)

%o int get_digit_sum(int integer, int *reverse)

%o {

%o int sum = 0;

%o int rev_num = 0;

%o int num = integer;

%o int rem = 0;

%o while (num != 0) {

%o rem = num % 10;

%o sum += rem;

%o num = num / 10;

%o rev_num = 10*rev_num + rem;

%o }

%o *reverse = rev_num;

%o return sum;

%o }

%o int is_square(int integer)

%o {

%o int mid = (int)(sqrt(integer));

%o if ((mid*mid) == integer) {

%o return mid;

%o }

%o else {

%o return 0;

%o }

%o }

%o int main(int argc, char *argv[])

%o {

%o int reverse = 0;

%o for (int j = 1; j <= 100011; j++) {

%o if (j % 10 == 0) {

%o continue;

%o }

%o int i = j*j;

%o int digit_sum = get_digit_sum(i, &reverse);

%o if ((i % digit_sum == 0) && (reverse % digit_sum == 0) &&

%o (is_square(digit_sum) != 0) && (is_square(reverse) != 0)) {

%o printf("%d, ", i);

%o }

%o }

%o printf("\n");

%o return 0;

%o }

%o (PARI) isok1(k) = if (k % 100, my(s=sumdigits(k), q=k/s); issquare(s) && issquare(q) && (denominator(q)==1));

%o isok(k) = isok1(k) && isok1(fromdigits(Vecrev(digits(k)))); \\ _Michel Marcus_, May 17 2022

%o (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

%Y Cf. A001102, A028839.

%Y Subsequence of A061457.

%K nonn,base

%O 1,2

%A _Debapriyay Mukhopadhyay_, May 17 2022