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.

A366960 Numbers whose difference between the largest and smallest digits is equal to 3.

This page as a plain text file.
%I A366960 #24 Apr 04 2024 12:35:52
%S A366960 14,25,30,36,41,47,52,58,63,69,74,85,96,103,114,124,130,134,141,142,
%T A366960 143,144,203,214,225,230,235,241,245,252,253,254,255,300,301,302,303,
%U A366960 310,314,320,325,330,336,341,346,352,356,363,364,365,366,411,412,413,414
%N A366960 Numbers whose difference between the largest and smallest digits is equal to 3.
%C A366960 The number of n-digit terms of this sequence is 27*4^(n-1) - 41*3^(n-1) + 7*2^n.
%H A366960 Stefano Spezia, <a href="/A366960/b366960.txt">Table of n, a(n) for n = 1..10000</a>
%t A366960 Select[Range[415],Max[d=IntegerDigits[#]]-Min[d]==3 &]
%o A366960 (Python)
%o A366960 def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 3
%o A366960 print([k for k in range(420) if ok(k)]) # _Michael S. Branicky_, Oct 30 2023
%o A366960 (Python)
%o A366960 from itertools import chain, count, islice, combinations_with_replacement
%o A366960 from sympy.utilities.iterables import multiset_permutations
%o A366960 def A366960_gen(): # generator of terms
%o A366960     return chain.from_iterable(sorted(int(''.join(str(d) for d in t)) for a in range(7) for c in combinations_with_replacement(range(a,a+4),l) for t in multiset_permutations((a,a+3)+c) if t[0]) for l in count(0))
%o A366960 A366960_list = list(islice(A366960_gen(),30)) # _Chai Wah Wu_, Nov 10 2023
%o A366960 (PARI) isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 3; \\ _Michel Marcus_, Nov 05 2023
%Y A366960 Cf. A037904.
%Y A366960 Cf. A010785 (difference = 0), A366958 (difference = 1), A366959 (difference = 2), A366961 (difference = 4), A366962 (difference = 5), A366963 (difference = 6), A366964 (difference = 7), A366965 (difference = 8), A366966 (difference = 9).
%K A366960 nonn,base,easy
%O A366960 1,1
%A A366960 _Stefano Spezia_, Oct 30 2023