OFFSET
1,1
COMMENTS
Called Dennis numbers as a tribute to user Dennis for winning the robbers' part of The Programming Language Quiz of the Programming Puzzles & Code Golf Stack Exchange website.
Number of d-digit terms for d in [1..8]: [0, 9, 162, 846, 10044, 55548, 608472, 3911256]. - Jon E. Schoenfield, Oct 11 2015
LINKS
Jon E. Schoenfield, Table of n, a(n) for n = 1..10000
Programming Puzzles & Code Golf Stack Exchange, Generate Dennis Numbers, Sep 11 2015.
EXAMPLE
10 is in the sequence since rearranging the 1 and 0 gives the digit string "01", which evaluates to 1, which is a palindrome.
16612 is in the sequence since its digits can be rearranged (as 16261 or 61216) to form a palindrome.
212 is not in the sequence since it is already palindromic.
Since all one-digit numbers are already palindromic, they are not in the sequence.
MATHEMATICA
palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; Select[Range@ 330, And[! palQ@ #, AnyTrue[FromDigits /@ Permutations@ IntegerDigits@ #, palQ]] &] (* Michael De Vlieger, Nov 03 2015, Version 10 *)
PROG
(Rust) fn d(mut i:u64)->(u64, i32){for n in 1..{let mut o=0; if n.to_string()==n.to_string().chars().rev().collect::<String>(){continue}let mut s=n.to_string().into_bytes(); for a in 0..s.len(){for b in a+1..s.len(){s.swap(a, b); {let t=s.iter().skip_while(|&x|*x==48).collect::<Vec<&u8>>(); if t.iter().cloned().rev().collect::<Vec<&u8>>()==t{o+=1}}s.swap(a, b); }}if o>0{i-=1; if i<1{return(n, o)}}}(0, 0)} // Program written by Programming Puzzles & Code Golf Stack Exchange user "Doorknob" on September 12, 2015
(Python)
def c(s): return sum(s.count(d)&1 for d in set(s)) == len(s)&1
def ok(n): s = str(n); return s != s[::-1] and c(s.replace("0", ""))
print([k for k in range(331) if ok(k)]) # Michael S. Branicky, Jul 25 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Matthew McCaskill, Oct 11 2015
STATUS
approved