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.

A077528 a(n) = smallest nontrivial (>1) palindrome == 1 (mod n).

This page as a plain text file.
%I A077528 #14 Dec 03 2023 10:02:30
%S A077528 3,4,5,6,7,8,9,55,11,111,121,66,99,121,33,171,55,77,101,22,111,323,
%T A077528 121,101,131,55,141,88,121,373,33,232,171,141,181,1111,77,313,121,575,
%U A077528 505,44,353,181,323,424,1441,99,101,868,313,10601,55,111,393,343,929,414
%N A077528 a(n) = smallest nontrivial (>1) palindrome == 1 (mod n).
%H A077528 Robert Israel, <a href="/A077528/b077528.txt">Table of n, a(n) for n = 2..10000</a>
%p A077528 f:= proc(n) local d, S,j,q,x0,t,r,x;
%p A077528     for d from 2 do
%p A077528       S[ceil(d/2)+1]:= {0}:
%p A077528       for j from ceil(d/2) to 1 by -1 do
%p A077528         if j = (d+1)/2 then q:= 10^(j-1)
%p A077528         else q:= 10^(j-1)+10^(d-j)
%p A077528         fi;
%p A077528         if j = 1 then x0:= 1 else x0:= 0 fi;
%p A077528         S[j]:= {seq(seq(x*q+s mod n, x=x0..9), s=S[j+1])};
%p A077528       od;
%p A077528       if member(1, S[1]) then
%p A077528          t:= 1; r:= 0;
%p A077528          for j from 1 to ceil(d/2) do
%p A077528            if j = (d+1)/2 then q:= 10^(j-1) else q:= 10^(j-1)+10^(d-j) fi;
%p A077528            if j = 1 then x0:= 1 else x0:= 0 fi;
%p A077528            for x from x0 to 9 do
%p A077528              if member(t - x*q mod n, S[j+1]) then
%p A077528                 r:= r + x*q;
%p A077528                 t:= t - x*q mod n;
%p A077528                 break
%p A077528              fi
%p A077528            od;
%p A077528         od;
%p A077528         return r
%p A077528       fi
%p A077528    od
%p A077528 end proc:
%p A077528 $3..9, seq(f(n),n=9..100); # _Robert Israel_, Dec 17 2019
%t A077528 With[{pals=Select[Range[2,11000],PalindromeQ]},Table[SelectFirst[pals,Mod[#,n]==1&],{n,2,60}]] (* _Harvey P. Dale_, Dec 03 2023 *)
%Y A077528 Cf. A002113.
%K A077528 base,nonn,look
%O A077528 2,1
%A A077528 _Amarnath Murthy_, Nov 08 2002
%E A077528 Corrected and extended by _Ray Chandler_, Aug 20 2003