login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A062892 Number of squares that can be obtained by permuting the digits of n. 6
1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,101
COMMENTS
The original definition was ambiguous (it did not specify how repeated digits or leading zeros are to be handled). Here is a precise version (based on the Mathematica code):
Suppose the decimal expansion of n has d digits. Apply all d! permutations, discard duplicates, but keep any with leading zeros; now ignore leading zeros; a(n) is the number of squares on the resulting list. For example, if n = 100 we end up with 100, 010, 001, and both 100 and 1 are squares, so a(100)=2. If n=108 we get 6 numbers but only (0)81 is a square, so a(108)=1. - N. J. A. Sloane, Jan 16 2014
LINKS
FORMULA
a(A096600(n))=0; a(A007937(n))>0; a(A096599(n))=1; a(A096598(n))>1. - Reinhard Zumkeller, Jun 29 2004
EXAMPLE
a(169) = 3; the squares obtained by permuting the digits are 169, 196, 961.
MATHEMATICA
Table[t1=Table[FromDigits[k], {k, Permutations[IntegerDigits[n]]}]; p=Length[Select[t1, IntegerQ[Sqrt[#]]&]], {n, 0, 104}] (* Jayanta Basu, May 17 2013 *)
PROG
(PARI) a(n) = {my(d = vecsort(digits(n)), res = 0); forperm(d, p, res += issquare(fromdigits(Vec(p)))); res } \\ David A. Corneth, Oct 18 2021
(Python)
from math import isqrt
from sympy.utilities.iterables import multiset_permutations as mp
def sqr(n): return isqrt(n)**2 == n
def a(n):
s = str(n)
perms = (int("".join(p)) for p in mp(s, len(s)))
return len(set(p for p in perms if sqr(p)))
print([a(n) for n in range(105)] ) # Michael S. Branicky, Oct 18 2021
CROSSREFS
A096599 gives the squares k^2 such that a(k^2) = 1.
Sequence in context: A361162 A118626 A277149 * A118553 A102448 A102683
KEYWORD
base,nonn,easy
AUTHOR
Amarnath Murthy, Jun 29 2001
EXTENSIONS
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 02 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 11:21 EDT 2024. Contains 371936 sequences. (Running on oeis4.)