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.

A083831 Palindromes n such that 4n + 1 is also a palindrome.

Original entry on oeis.org

1, 2, 8, 88, 131, 141, 232, 242, 888, 8888, 13031, 13131, 13231, 14041, 14141, 14241, 23032, 23132, 23232, 24042, 24142, 24242, 88888, 888888, 1303031, 1304031, 1313131, 1314131, 1323231, 1324231, 1403041, 1404041, 1413141, 1414141
Offset: 1

Views

Author

Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 09 2003

Keywords

Comments

Among infinite subsequences are the repdigits 8...8 = 8*(10^k-1)/9. It appears that the only terms with an even number of digits are these for even k. - Robert Israel, Apr 04 2018

Examples

			13231 and 52925 are palindromes and 4*13231+1=52925, therefore 13231 is a term.
		

Crossrefs

Programs

  • Maple
    N:= 100: # to get the first N terms
    fe:= proc(x,d) local L;
       L:= convert(x,base,10);
       add(L[j]*(10^(d-j)+10^(d+j-1)),j=1..d)
    end proc:
    fo:= proc(x,d) local L;
      L:= convert(x,base,10);
      add(L[j]*(10^(d-j)+10^(d+j-2)),j=2..d) + L[1]*10^(d-1);
    end proc:
    ispali:= proc(n) local L;
       L:= convert(n,base,10);
       L = ListTools:-Reverse(L)
    end proc:
    count:= 0: Res:= NULL:
    for d from 1 while count < N do
      for x from 10^(d-1) to 10^d-1 while count < N do
        y:= fo(x,d);
      if ispali(4*y+1) then
         count:= count+1; Res:= Res, y;
      fi
    od:
    for x from 10^(d-1) to 10^d-1 while count < N do
        y:= fe(x,d);
      if ispali(4*y+1) then
         count:= count+1; Res:= Res, y;
      fi
    od:
    od:
    Res; # Robert Israel, Apr 04 2018
  • Mathematica
    Select[Range[15*10^5],AllTrue[{#,4#+1},PalindromeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Mar 08 2018 *)
  • PARI
    isok(n) = my(dn = digits(n), dm = digits(4*n+1)); (Vecrev(dn) == dn) && (Vecrev(dm) == dm); \\ Michel Marcus, Apr 04 2018

Extensions

Corrected and extended by Reinhard Zumkeller and Ray Chandler, May 18 2003