login
Search: author:khovanova
     Sort: relevance | references | number | modified | created      Format: long | short | data
a(n) = 3a(n-1) + 3a(n-2). a(0) = 1, a(1) = 4.
+0
24
1, 4, 15, 57, 216, 819, 3105, 11772, 44631, 169209, 641520, 2432187, 9221121, 34959924, 132543135, 502509177, 1905156936, 7222998339, 27384465825, 103822392492, 393620574951, 1492328902329, 5657848431840, 21450532002507
OFFSET
0,2
COMMENTS
Number of aa-avoiding words of length n on the alphabet {a,b,c,d}.
Equals row 3 of the array shown in A180165, the INVERT transform of A028859 and the INVERTi transform of A086347. - Gary W. Adamson, Aug 14 2010
From Tom Copeland, Nov 08 2014: (Start)
This array is one of a family related by compositions of C(x)= [1-sqrt(1-4x)]/2, an o.g.f. for A000108; its inverse Cinv(x) = x(1-x); and the special Mobius transformation P(x,t) = x / (1+t*x) with inverse P(x,-t) in x. Cf. A091867.
O.g.f.: G(x) = P[P[P[-Cinv(-x),-1],-1],-1] = P[-Cinv(-x),-3] = x*(1+x)/[1-3x(1-x)]= x*A125145(x).
Ginv(x) = -C[-P(x,3)] = [-1 + sqrt(1+4x/(1+3x))]/2 = x*A104455(-x).
G(-x) = -x(1-x) * [ 1 - 3*[x*(1+x)] + 3^2*[x*(1+x)]^2 - ...] , and so this array is related to finite differences in the row sums of A030528 * Diag((-3)^1,3^2,(-3)^3,..). (Cf. A146559.)
The inverse of -G(-x) is C[-P(-x,3)]= [1 - sqrt(1-4x/(1-3x))]/2 = x*A104455(x). (End)
Number of 3-compositions of n+1 restricted to parts 1 and 2 (and allowed zeros); see Hopkins & Ouvry reference. - Brian Hopkins, Aug 16 2020
LINKS
D. Birmajer, J. B. Gil, and M. D. Weiner, On the Enumeration of Restricted Words over a Finite Alphabet, J. Int. Seq. 19 (2016) # 16.1.3, Example 7.
Martin Burtscher, Igor Szczyrba, and Rafał Szczyrba, Analytic Representations of the n-anacci Constants and Generalizations Thereof, Journal of Integer Sequences, Vol. 18 (2015), Article 15.4.5.
Brian Hopkins and Stéphane Ouvry, Combinatorics of Multicompositions, arXiv:2008.04937 [math.CO], 2020.
Milan Janjic, On Linear Recurrence Equations Arising from Compositions of Positive Integers, Journal of Integer Sequences, Vol. 18 (2015), Article 15.4.7.
Tanya Khovanova, Recursive Sequences
FORMULA
G.f.: (1+z)/(1-3z-3z^2). - Emeric Deutsch, Feb 27 2007
a(n) = (5*sqrt(21)/42 + 1/2)*(3/2 + sqrt(21)/2)^n + (-5*sqrt(21)/42 + 1/2)*(3/2 - sqrt(21)/2)^n. - Antonio Alberto Olivares, Mar 20 2008
a(n) = A030195(n)+A030195(n+1). - R. J. Mathar, Feb 13 2022
E.g.f.: exp(3*x/2)*(21*cosh(sqrt(21)*x/2) + 5*sqrt(21)*sinh(sqrt(21)*x/2))/21. - Stefano Spezia, Aug 04 2022
MAPLE
a[0]:=1: a[1]:=4: for n from 2 to 27 do a[n]:=3*a[n-1]+3*a[n-2] od: seq(a[n], n=0..27); # Emeric Deutsch, Feb 27 2007
A125145 := proc(n)
option remember;
if n <= 1 then
op(n+1, [1, 4]) ;
else
3*(procname(n-1)+procname(n-2)) ;
end if;
end proc: # R. J. Mathar, Feb 13 2022
MATHEMATICA
nn=23; CoefficientList[Series[(1+x)/(1-3x-3x^2), {x, 0, nn}], x] (* Geoffrey Critzer, Feb 09 2014 *)
LinearRecurrence[{3, 3}, {1, 4}, 30] (* Harvey P. Dale, May 01 2022 *)
PROG
(Haskell)
a125145 n = a125145_list !! n
a125145_list =
1 : 4 : map (* 3) (zipWith (+) a125145_list (tail a125145_list))
-- Reinhard Zumkeller, Oct 15 2011
(Magma) I:=[1, 4]; [n le 2 select I[n] else 3*Self(n-1)+3*Self(n-2): n in [1..40]]; // Vincenzo Librandi, Nov 10 2014
CROSSREFS
Cf. A028859 = a(n+2) = 2 a(n+1) + 2 a(n); A086347 = On a 3 X 3 board, number of n-move routes of chess king ending at a given side cell. a(n) = 4a(n-1) + 4a(n-2).
Cf. A128235.
Cf. A180165, A028859, A086347. - Gary W. Adamson, Aug 14 2010
KEYWORD
nonn,easy
AUTHOR
_Tanya Khovanova_, Jan 11 2007
STATUS
approved
Sums of two distinct prime cubes.
+0
18
35, 133, 152, 351, 370, 468, 1339, 1358, 1456, 1674, 2205, 2224, 2322, 2540, 3528, 4921, 4940, 5038, 5256, 6244, 6867, 6886, 6984, 7110, 7202, 8190, 9056, 11772, 12175, 12194, 12292, 12510, 13498, 14364, 17080, 19026, 24397, 24416, 24514
OFFSET
1,1
COMMENTS
If an element of this sequence is odd, it must be of the form a(n)=8+p^3, else it is a(n)=p^3+q^3 with two primes p>q>2. - M. F. Hasler, Apr 13 2008
LINKS
M. F. Hasler and Charles R Greathouse IV, Table of n, a(n) for n = 1..10000 (first 284 terms from Hasler)
FORMULA
A120398 = (A030078 + A030078) - 2*A030078 = 8+(A030078\{8}) U { A030078(m)+A030078(n) ; 1<m<n } - M. F. Hasler, Apr 13 2008
EXAMPLE
2^3+3^3=35=a(1), 2^3+5^3=133=a(2), 3^3+5^3=152=a(3), 2^3+7^3=351=a(4).
MATHEMATICA
Select[Sort[ Flatten[Table[Prime[n]^3 + Prime[k]^3, {n, 15}, {k, n - 1}]]], # <= Prime[15^3] &]
PROG
(PARI) isA030078(n)=n==round(sqrtn(n, 3))^3 && isprime(round(sqrtn(n, 3))) \\ M. F. Hasler, Apr 13 2008
(PARI) isA120398(n)={ n%2 & return(isA030078(n-8)); n<35 & return; forprime( p=ceil( sqrtn( n\2+1, 3)), sqrtn(n-26.5, 3), isA030078(n-p^3) & return(1))} \\ M. F. Hasler, Apr 13 2008
(PARI) for( n=1, 10^6, isA120398(n) & print1(n", ")) \\ - M. F. Hasler, Apr 13 2008
(PARI) list(lim)=my(v=List()); lim\=1; forprime(q=3, sqrtnint(lim-8, 3), my(q3=q^3); forprime(p=2, min(sqrtnint(lim-q3, 3), q-1), listput(v, p^3+q3))); Set(v) \\ Charles R Greathouse IV, Mar 31 2022
CROSSREFS
Subsequence of A024670.
KEYWORD
nonn,easy
AUTHOR
_Tanya Khovanova_, Jul 24 2007
STATUS
approved
Evil odd numbers.
+0
17
3, 5, 9, 15, 17, 23, 27, 29, 33, 39, 43, 45, 51, 53, 57, 63, 65, 71, 75, 77, 83, 85, 89, 95, 99, 101, 105, 111, 113, 119, 123, 125, 129, 135, 139, 141, 147, 149, 153, 159, 163, 165, 169, 175, 177, 183, 187, 189, 195, 197, 201, 207, 209, 215, 219, 221, 225, 231, 235
OFFSET
1,1
COMMENTS
A heuristic argument suggests that, as n tends to infinity, a(n)/n converges to 4. - Stefan Steinerberger, May 17 2007
These numbers may be called primitive evil numbers because every evil number is a power of 2 multiplied by one of these numbers. Note that the difference between consecutive terms is either 2, 4, or 6. - T. D. Noe, Jun 06 2007
A132680(a(n)) = A132680((a(n)-1)/2) + 2. - Reinhard Zumkeller, Aug 26 2007
If m is in the sequence, then so is 2m-1 because in binary, m is x1 and 2m-1 is x01. Presumably the numbers that generate the whole sequence by application of n -> 2n-1 are the evil numbers times 4 plus 3. - Ralf Stephan, May 25 2013
FORMULA
a(n) = 2*A000069(n) + 1. a(n) is 1 plus twice odious numbers. a(n) = A128309(n) + 1. a(n) is 1 plus odious even numbers.
a(n) = 4n + O(1). - Charles R Greathouse IV, Mar 21 2013
a(n) = A001969(1+A000069(n)) = A277902(A277823(n)). - Antti Karttunen, Nov 05 2016
MATHEMATICA
Select[Range[300], OddQ[ # ] && EvenQ[DigitCount[ #, 2, 1]] &] (* Stefan Steinerberger, May 17 2007 *)
Select[Range[300], EvenQ[Plus @@ IntegerDigits[ #, 2]] && OddQ[ # ] &]
PROG
(PARI) is(n)=n%2 && hammingweight(n)%2==0 \\ Charles R Greathouse IV, Mar 21 2013
(PARI) a(n)=4*n-if(hammingweight(n-1)%2, 3, 1) \\ Charles R Greathouse IV, Mar 21 2013
(Python)
def A129771(n): return (((m:=n-1)<<1)+(m.bit_count()&1^1)<<1)+1 # Chai Wah Wu, Mar 09 2023
CROSSREFS
This sequence is the intersection of A001969 (Evil numbers: even number of 1's in binary expansion.) and A005408 (The odd numbers: a(n) = 2n+1.) A093688 (Numbers n such that all divisors of n, excluding the divisor 1, have an even number of 1's in their binary expansions) is a subsequence.
Cf. A092246 (odd odious numbers).
Column 2 of A277880, positions of 1's in A277808 (2's in A277822).
KEYWORD
nonn,easy
AUTHOR
_Tanya Khovanova_, May 16 2007
EXTENSIONS
More terms from Stefan Steinerberger, May 17 2007
STATUS
approved
Aspiring numbers: numbers whose aliquot sequence terminates in a perfect number.
+0
16
25, 95, 119, 143, 417, 445, 565, 608, 650, 652, 675, 685, 783, 790, 909, 913
OFFSET
1,1
COMMENTS
There are many numbers whose aliquot sequences have not yet been completely computed, so this sequence is not fully known. In particular, 276 may, perhaps, be an element of this sequence, although this is very unlikely.
Numbers less than 1000 whose aliquot sequence is not known that could possibly be in this sequence are: 276, 306, 396, 552, 564, 660, 696, 780, 828, 888, 966, 996. - Robert Price, Jun 03 2013
REFERENCES
No number terminates at 28, the second perfect number.
LINKS
Eric Weisstein's World of Mathematics, Aspiring Number
EXAMPLE
The divisors of 95 less than itself are 1, 5 and 19. They sum to 25. The divisors of 25 less than itself are 1 and 5. They sum to 6, which is perfect.
MATHEMATICA
perfectQ[n_] := DivisorSigma[1, n] == 2*n; maxAliquot = 10^45; A131884 = {}; s[1] = 1; s[n_] := DivisorSigma[1, n] - n; selQ[n_ /; n <= 5] = False; selQ[n_] := NestWhile[s, n, If[{##}[[-1]] > maxAliquot, Print["A131884: ", n]; AppendTo[A131884, n]; False, Length[{##}] < 4 || {##}[[-4 ;; -3]] != {##}[[-2 ;; -1]]] &, All] // perfectQ; Reap[For[k = 1, k < 1000, k++, If[! perfectQ[k] && selQ[k], Print[k]; Sow[k]]]][[2, 1]] (* Jean-François Alcover, Nov 15 2013 *)
CROSSREFS
KEYWORD
hard,nice,nonn
AUTHOR
_Tanya Khovanova_ and Alexey Radul, Aug 14 2001
EXTENSIONS
a(13)-a(16) from Robert Price, Jun 03 2013
STATUS
approved
Number of different equations that can be made by summing numbers from 1 to n and using every number not more than once.
+0
16
0, 0, 1, 3, 7, 17, 43, 108, 273, 708, 1867, 4955, 13256, 35790, 97340, 266240, 732014, 2022558, 5612579, 15634288, 43702232, 122550885, 344661924, 971908613, 2747404212, 7784038617, 22100387619, 62869809733, 179173559128, 511497066733, 1462522478549, 4188024794407
OFFSET
1,4
COMMENTS
The summands of each side are in increasing order and the minimum of all summands is on the left side.
LINKS
FORMULA
a(n) ~ 3^(n+1) / (4*sqrt(Pi)*n^(3/2)). - Vaclav Kotesovec, Sep 11 2014
EXAMPLE
a(3) = 1, as the only equation we can make by summing numbers from the set {1, 2, 3} is 1+2=3. a(4) = 3, as we can make three equations: 1+2=3, 1+3=4, 1+4=2+3.
MAPLE
b:= proc(n, i) option remember; local m; m:= i*(i+1)/2;
if n>m then 0
elif n=m then 1
else b(n, i-1) +b(abs(n-i), i-1) +b(n+i, i-1)
fi
end:
a:= proc(n) option remember;
`if`(n>2, b(n, n-1)+ a(n-1), 0)
end:
seq(a(n), n=1..40); # Alois P. Heinz, Aug 31 2009, revised Sep 16 2011
MATHEMATICA
Table[(Length[ Select[Range[0, 3^n - 1], Apply[Plus, Pick[Range[n], PadLeft[IntegerDigits[ #, 3], n], 1]] == Apply[Plus, Pick[Range[n], PadLeft[IntegerDigits[ #, 3], n], 2]] &]] - 1)/ 2, {n, 14}]
CROSSREFS
Column k=2 of A196231.
KEYWORD
nonn
AUTHOR
_Tanya Khovanova_, Jun 22 2009
EXTENSIONS
More terms from Alois P. Heinz, Aug 31 2009
STATUS
approved
GCDs arising in A126196.
+0
13
11, 1093, 1093, 3511, 3511, 5557, 104891, 1006003
OFFSET
1,1
COMMENTS
All terms are primes. Note a connection to the Wieferich primes A001220: a(2) = a(3) = A001220(1), a(3) = a(4) = A001220(2).
From John Blythe Dobson, Jan 14 2017: (Start)
All Wieferich primes p will belong to this sequence twice, because if H([p/k]) denotes the harmonic number with index floor(p/k), then p divides all of H([p/4]), H([p/2]), and H(p-1). The first two of these elements gives one solution, and the second and third another. This property of the Wieferich primes predates their name, and was apparently first proved by Glaisher in "On the residues of r^(p-1) to modulus p^2, p^3, etc.," pp. 21-22, 23 (see References).
Note also a connection to the Mirimanoff primes A014127: a(1) = A014127(1), a(8) = A014127(2). All Mirimanoff primes p will belong to this sequence, because p divides both H([p/3]) and H([2p/3]). This property of the Mirimanoff primes likewise predates their name, and was apparently first proved by Glaisher in "A general congruence theorem relating to the Bernoullian function," p. 50 (see Links).
The Wieferich primes and Mirimanoff primes would seem to be the only cases for which the value of n in A126196(n) is predictable from knowledge of p. It is not obvious that all members of the present sequence are prime; however, by definition all their divisors must be non-harmonic primes A092102. Furthermore, it is clear from the cited literature under that entry that H([n/2]) == H(n) == 0 (mod p) is only possible when n < p. Thus, all divisors of the present sequence must belong to the harmonic irregular primes A092194.
One possible reason for interest in this sequence is a 1995 result of Dilcher and Skula (see Links) which among other things shows that if a prime p were an exception to the first case of Fermat's Last Theorem, then p would divide both H([p/k]) and H([2p/k]) for every value of k from 2 to 46. To date, the only values for which such coincidences have been found have k = 2, 3, or 4. For k = 6 to hold, p would have to be simultaneously a Wieferich prime and a Mirimanoff prime, while for k = 5 to hold, p would have to be simultaneously a Wall-Sun-Sun prime and a member of A123692. The sparse numerical results for the present sequence suggest that even the more relaxed condition H([n/2]) == H(n) == 0 (mod p) is rarely satisfied. (End)
REFERENCES
J. W. L. Glaisher, On the residues of r^(p-1) to modulus p^2, p^3, etc., Quarterly Journal of Pure and Applied Mathematics 32 (1900-1901), 1-27.
LINKS
Karl Dilcher and Ladislav Skula, A new criterion for the first case of Fermat's Last Theorem, Mathematics of Computation 64 (1995), 363-392.
J. W. L. Glaisher, A general congruence theorem relating to the Bernoullian function, Proceedings of the London Mathematical Society 33 (1900-1901), 27-56.
MATHEMATICA
f[n_] := GCD @@ Numerator@ HarmonicNumber@ {n, Floor[n/2]}; f@ Select[ Range[5000], f[#] > 1 &] (* Giovanni Resta, May 13 2016 *)
KEYWORD
nonn,more
AUTHOR
Max Alekseyev and _Tanya Khovanova_, Mar 07 2007
EXTENSIONS
a(8) from Giovanni Resta, May 13 2016
STATUS
approved
Numbers k such that gcd(A001008(k), A001008(floor(k/2))) > 1.
+0
12
7, 546, 1092, 1755, 3510, 4896, 52447, 670668
OFFSET
1,1
COMMENTS
Note a connection to the Wieferich primes A001220: a(2) = (A001220(1) - 1)/2, a(3) = A001220(1) - 1, a(4) = (A001220(2) - 1)/2, a(5) = A001220(2) - 1. [Comment regarding a(2) added by Kevin J. Gomez, Jul 11 2017]
a(9) > 840000. - Giovanni Resta, May 13 2016
MATHEMATICA
Select[Range[5000], GCD @@ Numerator@ HarmonicNumber@{#, Floor[#/2]} > 1 &] (* Giovanni Resta, May 13 2016 *)
PROG
(PARI) a001008(n)=numerator(sum(i=1, n, 1/i))
for(n=1, 1e6, if(gcd(a001008(n), a001008(n/2)) > 1, print1(n, ", "))) \\ Felix Fröhlich, Aug 08 2014
CROSSREFS
The corresponding GCDs are given by A126197.
KEYWORD
nonn,more
AUTHOR
Max Alekseyev and _Tanya Khovanova_, Mar 07 2007, corrected Mar 10 2007
EXTENSIONS
a(8) from Giovanni Resta, May 13 2016
STATUS
approved
a(n) = R(f(n)), where R = A004086 = reverse (decimal) digits, f = A071786 = reverse digits of prime factors.
+0
12
1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 21, 13, 41, 51, 61, 17, 81, 19, 2, 12, 22, 23, 42, 52, 26, 72, 82, 29, 3, 31, 23, 33, 241, 53, 63, 37, 281, 39, 4, 41, 24, 43, 44, 54, 46, 47, 84, 94, 5, 312, 421, 53, 45, 55, 65, 372, 481, 59, 6, 61, 62, 36, 46, 551, 66, 67, 482, 69, 7, 71, 27
OFFSET
1,2
COMMENTS
Might be called TITO(n), turning n inside out then turning outside in.
Here is the operation: take a number n and find its prime factors. Reverse the digits of every prime factor (for example, replace 17 by 71). Multiply the factors respecting multiplicities. For example, if the original number was 17^2*43^3, the new product will be 71^2*34^3. After that, reverse the resulting number.
LINKS
M. F. Hasler, Table of n, a(n) for n=1..5000. [From M. F. Hasler, Jun 24 2009]
T. Khovanova, Turning Numbers Inside Out [From Tanya Khovanova, Jul 07 2009]
FORMULA
a(p) = p, for prime p.
a(A161598(n)) <> A161598(n); a(A161597(n)) = A161597(n); A010051(a(A161600(n))) = 1.
From M. F. Hasler, Jun 25 2009: (Start)
a( p*10^k ) = p for any prime p.
Proof: if gcd( p, 2*5) = 1, then a( p * 10^k ) = R( R(p) * R(2)^k * R(5)^k ) = R( R(p) * 10^k ) = R(R(p)) = p;
if gcd(p, 2*5) = 2, then p=2 and a( p * 10^k ) = R( R(2)^(k+1) * R(5)^k ) = R( 2 * 10^k ) = 2 = p and mutatis mutandis for gcd(p, 2*5) = 5. (End)
EXAMPLE
a(34) = 241, because 34 = 2*17, f(34) = 2*71 = 142, and reversing gives 241.
MAPLE
read("transforms") ; A071786 := proc(n) local ifs, a, d ; ifs := ifactors(n)[2] ; a := 1 ; for d in ifs do a := a*digrev(op(1, d))^op(2, d) ; od: a ; end: A161594 := proc(n) digrev(A071786(n)) ; end: seq(A161594(n), n=1..80) ; # R. J. Mathar, Jun 16 2009
# second Maple program:
r:= n-> (s-> parse(cat(seq(s[-i], i=1..length(s)))))(""||n):
a:= n-> r(mul(r(i[1])^i[2], i=ifactors(n)[2])):
seq(a(n), n=1..100); # Alois P. Heinz, Jun 19 2017
MATHEMATICA
reversepower[{n_, k_}] := FromDigits[Reverse[IntegerDigits[n]]]^k f[n_] := FromDigits[ Reverse[IntegerDigits[Times @@ Map[reversepower, FactorInteger[n]]]]] Table[f[n], {n, 100}]
Table[IntegerReverse[Times@@Flatten[Table[IntegerReverse[#[[1]]], #[[2]]]& /@FactorInteger[n]]], {n, 100}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 21 2016 *)
PROG
(PARI) R=A004086; A161594(n)={n=factor(n); n[, 1]=apply(R, n[, 1]); R(factorback(n))} \\ M. F. Hasler, Jun 24 2009. Removed code for R here, see A004086 for most recent & efficient version. - M. F. Hasler, May 11 2015
(Haskell) a161594 = a004086 . a071786 -- Reinhard Zumkeller, Oct 14 2011
(Python)
from math import prod
from sympy import factorint
def f(n): return prod(int(str(p)[::-1])**e for p, e in factorint(n).items())
def R(n): return int(str(n)[::-1])
def a(n): return 1 if n == 1 else R(f(n))
print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Mar 28 2022
KEYWORD
nonn,base,nice,look
AUTHOR
J. H. Conway & _Tanya Khovanova_, Jun 14 2009
EXTENSIONS
Simpler definition from R. J. Mathar, Jun 16 2009
Edited by N. J. A. Sloane, Jun 23 2009
STATUS
approved
a(n) is the total sum of the digits of n-digit primes.
+0
11
17, 197, 2041, 19879, 195226, 1920513, 18980518, 188098738, 1867197599, 18562452601, 184727304713, 1839816627645, 18335212785129, 182813489520604
OFFSET
1,1
MATHEMATICA
Table[Plus @@ Flatten[IntegerDigits[Select[Range[10^(n - 1), 10^n], PrimeQ[ # ] &]]], {n, 7}]
PROG
(PARI) A007953(n)={ local(a=0, shft=n) ; while(shft!=0, a += shft %10 ; shft \= 10 ; ) ; return(a) ; }
A130817(n)={ local(a=0) ; forprime(p=10^(n-1), 10^n, a += A007953(p) ; ) ; return(a) ; }
{ for(n=1, 30, print(A130817(n)" ") ; ) ; } \\ R. J. Mathar, Jan 16 2008
CROSSREFS
Cf. A006879.
KEYWORD
base,more,nonn
AUTHOR
_Tanya Khovanova_, Jul 16 2007
EXTENSIONS
a(8) from R. J. Mathar, Jan 16 2008
a(9)-a(11) from Jon E. Schoenfield, Dec 01 2008
a(12)-a(14) from Giovanni Resta, Jul 20 2015
STATUS
approved
Numbers where any two consecutive decimal digits differ by 1 after arranging the digits in decreasing order.
+0
11
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 102, 120, 123, 132, 201, 210, 213, 231, 234, 243, 312, 321, 324, 342, 345, 354, 423, 432, 435, 453, 456, 465, 534, 543, 546, 564, 567, 576, 645, 654, 657, 675, 678, 687, 756, 765, 768, 786, 789, 798, 867
OFFSET
1,3
COMMENTS
a(4091131) = 9876543210 is the last term.
Numbers n such that A004186(n) is a term of A033075. - Felix Fröhlich, Dec 26 2017
Also 0 together with positive integers having k distinct digits and the difference between the largest and the smallest digit equal to k-1. - David A. Corneth, Dec 26 2017
FORMULA
If zero is excluded, the number of terms with k digits, 1 <= k <= 10, is (11-k)*k! - (k-1)!. - Franklin T. Adams-Watters, Aug 01 2012
MATHEMATICA
lst = {}; Do[If[Times @@ Differences@Sort@IntegerDigits[n] == 1, AppendTo[lst, n]], {n, 0, 675}]; lst (* Arkadiusz Wesolowski, Aug 01 2012 *)
Join[Range[0, 9], Select[Range[1000], Union[Differences[Sort[ IntegerDigits[ #]]]] == {1}&]] (* Harvey P. Dale, Jan 14 2015 *)
PROG
(PARI) is(n)=my(v=vecsort(eval(Vec(Str(n))))); for(i=2, #v, if(v[i]!=1+v[i-1], return(0))); 1
(PARI) is(n) = if(!n, return(1)); my(d = digits(n), v = vecsort(d, , 8)); #d == #v && v[#v] - v[1] == #v - 1
(Python)
# Ely Golden, Dec 26 2017
def consecutive(li):
for i in range(len(li)-1):
if(li[i+1]!=1+li[i]): return False
return True
def sorted_digits(n):
lst=[]
while(n>0):
lst+=[n%10] ; n//=10
lst.sort() ; return lst
j=0
for i in range(1, 10001):
while(not consecutive(sorted_digits(j))): j+=1
print(str(i)+" "+str(j)) ; j+=1
(Python) # alternate for generating full sequence in seconds
from itertools import permutations as perms
frags = ["0123456789"[i:j] for i in range(10) for j in range(i+1, 11)]
afull = sorted(set(int("".join(s)) for f in frags for s in perms(f)))
print(afull[:70]) # Michael S. Branicky, Aug 04 2022
CROSSREFS
KEYWORD
nonn,base,fini
AUTHOR
_Tanya Khovanova_ and Charles R Greathouse IV, Jul 31 2012
EXTENSIONS
Name edited by Felix Fröhlich, Dec 26 2017
STATUS
approved

Search completed in 0.150 seconds