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.

Showing 1-10 of 11 results. Next

A005150 Look and Say sequence: describe the previous term! (method A - initial term is 1).

Original entry on oeis.org

1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, 31131211131221, 13211311123113112211, 11131221133112132113212221, 3113112221232112111312211312113211, 1321132132111213122112311311222113111221131221, 11131221131211131231121113112221121321132132211331222113112211, 311311222113111231131112132112311321322112111312211312111322212311322113212221
Offset: 1

Views

Author

Keywords

Comments

Method A = "frequency" followed by "digit"-indication.
Also known as the "Say What You See" sequence.
Only the digits 1, 2 and 3 appear in any term. - Robert G. Wilson v, Jan 22 2004
All terms end with 1 (the seed) and, except the third a(3), begin with 1 or 3. - Jean-Christophe Hervé, May 07 2013
Proof that 333 never appears in any a(n): suppose it appears for the first time in a(n); because of "three 3" in 333, it would imply that 333 is also in a(n-1), which is a contradiction. - Jean-Christophe Hervé, May 09 2013
This sequence is called "suite de Conway" in French (see Wikipédia link). - Bernard Schott, Jan 10 2021
Contrary to many accounts (including an earlier comment on this page), Conway did not invent the sequence. The first mention of the sequence appears to date back to the 1977 International Mathematical Olympiad in Belgrade, Yugoslavia. See the Editor's note on page 4, directly preceding Conway's article in Eureka referenced below. - Harlan J. Brothers, May 03 2024

Examples

			The term after 1211 is obtained by saying "one 1, one 2, two 1's", which gives 111221.
		

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 208.
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, section 6.12 Conway's Constant, pp. 452-455.
  • M. Gilpin, On the generalized Gleichniszahlen-Reihe sequence, Manuscript, Jul 05 1994.
  • A. Lakhtakia and C. Pickover, Observations on the Gleichniszahlen-Reihe: An Unusual Number Theory Sequence, J. Recreational Math., 25 (No. 3, 1993), 192-198.
  • Clifford A. Pickover, Computers and the Imagination, St Martin's Press, NY, 1991.
  • Clifford A. Pickover, Fractal horizons: the future use of fractals, New York: St. Martin's Press, 1996. ISBN 0312125992. Chapter 7 has an extensive description of the elements and their properties.
  • C. A. Pickover, The Math Book, Sterling, NY, 2009; see p. 486.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, 1999, p. 23.
  • I. Vardi, Computational Recreations in Mathematica. Addison-Wesley, Redwood City, CA, 1991, p. 4.

Crossrefs

Cf. A001387, Periodic table: A119566.
Cf. A225224, A221646, A225212 (continuous versions).
Apart from the first term, all terms are in A001637.
About digits: A005341 (number of digits), A022466 (number of 1's), A022467 (number of 2's), A022468 (number of 3's), A004977 (sum of digits), A253677 (product of digits).
About primes: A079562 (number of distinct prime factors), A100108 (terms that are primes), A334132 (smallest prime factor).
Cf. A014715 (Conway's constant), A098097 (terms interpreted as written in base 4).

Programs

  • Haskell
    import List
    say :: Integer -> Integer
    say = read . concatMap saygroup . group . show
    where saygroup s = (show $ length s) ++ [head s]
    look_and_say :: [Integer]
    look_and_say = 1 : map say look_and_say
    -- Josh Triplett (josh(AT)freedesktop.org), Jan 03 2007
    
  • Haskell
    a005150 = foldl1 (\v d -> 10 * v + d) . map toInteger . a034002_row
    -- Reinhard Zumkeller, Aug 09 2012
    
  • Java
    See Paulo Ortolan link.
    
  • Mathematica
    RunLengthEncode[ x_List ] := (Through[ {First, Length}[ #1 ] ] &) /@ Split[ x ]; LookAndSay[ n_, d_:1 ] := NestList[ Flatten[ Reverse /@ RunLengthEncode[ # ] ] &, {d}, n - 1 ]; F[ n_ ] := LookAndSay[ n, 1 ][ [ n ] ]; Table[ FromDigits[ F[ n ] ], {n, 1, 15} ]
    A005150[1] := 1; A005150[n_] := A005150[n] = FromDigits[Flatten[{Length[#], First[#]}&/@Split[IntegerDigits[A005150[n-1]]]]]; Map[A005150, Range[25]] (* Peter J. C. Moses, Mar 21 2013 *)
  • PARI
    A005150(n,a=1)={ while(n--, my(c=1); for(j=2,#a=Vec(Str(a)), if( a[j-1]==a[j], a[j-1]=""; c++, a[j-1]=Str(c,a[j-1]); c=1)); a[#a]=Str(c,a[#a]); a=concat(a)); a }  \\ M. F. Hasler, Jun 30 2011
  • Perl
    $str="1"; for (1 .. shift(@ARGV)) { print($str, ","); @a = split(//,$str); $str=""; $nd=shift(@a); while (defined($nd)) { $d=$nd; $cnt=0; while (defined($nd) && ($nd eq $d)) { $cnt++; $nd = shift(@a); } $str .= $cnt.$d; } } print($str);
    # Jeff Quilici (jeff(AT)quilici.com), Aug 12 2003
    
  • Perl
    # This outputs the first n elements of the sequence, where n is given on the command line.
    $s = 1;
    for (2..shift @ARGV) {
    print "$s, ";
    $s =~ s/(.)\1*/(length $&).$1/eg;
    }
    # Arne 'Timwi' Heizmann (timwi(AT)gmx.net), Mar 12 2008
    print "$s\n";
    
  • Python
    def A005150(n):
        p = "1"
        seq = [1]
        while (n > 1):
            q = ''
            idx = 0 # Index
            l = len(p) # Length
            while idx < l:
                start = idx
                idx = idx + 1
                while idx < l and p[idx] == p[start]:
                    idx = idx + 1
                q = q + str(idx-start) + p[start]
            n, p = n - 1, q
            seq.append(int(p))
        return seq
    # Olivier Mengue (dolmen(AT)users.sourceforge.net), Jul 01 2005
    
  • Python
    def A005150(n):
        seq = [1] + [None] * (n - 1) # allocate entire array space
        def say(s):
            acc = '' # initialize accumulator
            while len(s) > 0:
                i = 0
                c = s[0] # char of first run
                while (i < len(s) and s[i] == c): # scan first digit run
                    i += 1
                acc += str(i) + c # append description of first run
                if i == len(s):
                    break # done
                else:
                    s = s[i:] # trim leading run of digits
            return acc
        for i in range(1, n):
            seq[i] = int(say(str(seq[i-1])))
        return seq
    # E. Johnson (ejohnso9(AT)earthlink.net), Mar 31 2008
    
  • Python
    # program without string operations
    def sign(n): return int(n > 0)
    def say(a):
        r = 0
        p = 0
        while a > 0:
            c = 3 - sign((a % 100) % 11) - sign((a % 1000) % 111)
            r += (10 * c + (a % 10)) * 10**(2*p)
            a //= 10**c
            p += 1
        return r
    a = 1
    for i in range(1, 26):
        print(i, a)
        a = say(a)
    # Volker Diels-Grabsch, Aug 18 2013
    
  • Python
    import re
    def lookandsay(limit, sequence = 1):
        if limit > 1:
            return lookandsay(limit-1, "".join([str(len(match.group()))+match.group()[0] for matchNum, match in enumerate(re.finditer(r"(\w)\1*", str(sequence)))]))
        else:
            return sequence
    # lookandsay(3) --> 21
    # Nicola Vanoni, Nov 29 2016
    
  • Python
    import itertools
    x = "1"
    for i in range(20):
        print(x)
        x = ''.join(str(len(list(g)))+k for k,g in itertools.groupby(x))
    # Matthew Cotton, Nov 12 2019
    

Formula

a(n+1) = A045918(a(n)). - Reinhard Zumkeller, Aug 09 2012
a(n) = Sum_{k=1..A005341(n)} A034002(n,k)*10^(A005341(n)-k). - Reinhard Zumkeller, Dec 15 2012
a(n) = A004086(A007651(n)). - Bernard Schott, Jan 08 2021
A055642(a(n+1)) = A005341(n+1) = 2*A043562(a(n)). - Ya-Ping Lu, Jan 28 2025
Conjecture: DC(a(n)) ~ k * (Conway's constant)^n where k is approximately 1.021... and DC denotes the number of digit changes in the decimal representation of n (e.g., DC(13112221)=4 because 1->3, 3-1, 1->2, 2->1). - Bill McEachen, May 09 2025
Conjecture: lim_{n->infinity} (c2+c3-c1)/(c1+c2+c3) = 0.01 approximately, where ci is the number of appearances of 'i' in a(n). - Ya-Ping Lu, Jun 05 2025

A297770 Number of distinct runs in base-2 digits of n.

Original entry on oeis.org

1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 3, 2, 1, 2, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 2, 3, 2, 1, 2, 2, 3, 3, 2, 3, 4, 3, 3, 3, 2, 3, 4, 3, 3, 3, 2, 3, 4, 2, 4, 3, 2, 3, 2, 3, 3, 3, 2, 3, 2, 1, 2, 2, 3, 3, 3, 3, 4, 3, 3, 2, 3, 4, 3, 4, 4, 3, 3, 3, 3, 4, 3, 2, 3
Offset: 1

Views

Author

Clark Kimberling, Jan 26 2018

Keywords

Comments

Every positive integers occurs infinitely many times.
***
Guide to related sequences:
Base b # runs # distinct runs

Examples

			27 in base-2: 1,1,0,1,1; three runs, of which 2 are distinct:  0 and 11, so that a(27) = 2.
		

Crossrefs

Cf. A005811 (number of runs, not necessarily distinct).

Programs

  • Mathematica
    b = 2; s[n_] := Length[Union[Split[IntegerDigits[n, b]]]]
    Table[s[n], {n, 1, 200}]
  • PARI
    apply( {A297770(n)=my(r=[0,0], c); while(n, my(d=bitand(n,1), L=valuation(n+d, 2)); !bittest(r[1+d], L) && c++ && r[1+d] += 1<>=L); c}, [0..99]) \\ M. F. Hasler, Jul 13 2024
    
  • PARI
    a(n) = my(s=strjoin(binary(n)), v=vecsort(concat(strsplit(s, "1"), strsplit(s, "0")), , 8)); #v-(v[1]==""); \\ Ruud H.G. van Tol, Aug 05 2024
  • Python
    from itertools import groupby
    def A297770(n): return len(set(map(lambda x:tuple(x[1]),groupby(bin(n)[2:])))) # Chai Wah Wu, Jul 13 2024
    

A047726 Number of different numbers that are formed by permuting digits of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 6
Offset: 1

Views

Author

Keywords

Comments

The minimum value of a(A171102(n)) is 10*9!. - Altug Alkan, Jul 08 2016

Examples

			From 102 we get 102, 120, 210, 201, 12 and 21, so a(102)=6.
From 33950 with 5 digits, one '0', two '3', one '5' and one '9', we get 5! / (1! * 2! * 1! * 1!) = 60 different numbers and a(33950) = 60.  - _Bernard Schott_, Oct 20 2019
		

Crossrefs

Cf. A055098. Identical to A043537 and A043562 for n<100.
Cf. A179239. - Aaron Dunigan AtLee, Jul 14 2010

Programs

  • Haskell
    import Data.List (permutations, nub)
    a047726 n = length $ nub $ permutations $ show n
    -- Reinhard Zumkeller, Jul 26 2011
    
  • Maple
    f:= proc(n) local L;
      L:= convert(n,base,10);
      nops(L)!/mul(numboccur(i,L)!,i=0..9);
    end proc:
    map(f, [$1..1000]); # Robert Israel, Jul 08 2016
  • Mathematica
    pd[n_]:=Module[{p=Permutations[IntegerDigits[n]]},Length[Union [FromDigits/@p]]]; pd/@Range[120]  (* Harvey P. Dale, Mar 22 2011 *)
  • PARI
    a(n)=n=eval(Vec(Str(n)));(#n)!/prod(i=0,9,sum(j=1,#n,n[j]==i)!) \\ Charles R Greathouse IV, Sep 29 2011
    
  • PARI
    A047726(n)={local(c=Vec(0,10)); apply(d->c[d+1]++, digits(n)); logint(n*10,10)!/prod(i=1,10,c[i]!)} \\ M. F. Hasler, Oct 18 2019

Formula

a(n) << n / (log_10 n)^4.5 by Stirling's approximation. - Charles R Greathouse IV, Sep 29 2011
a(n) = A000142(A055642(n))/Product_{k=0..9} A000142(A100910(n,k)). - Robert Israel, Jul 08 2016

Extensions

Corrected by Henry Bottomley, Apr 19 2000

A137214 a(n) is the number of distinct decimal digits in 2^n.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 3, 5, 4, 4, 7, 6, 5, 4, 4, 4, 6, 6, 6, 9, 7, 7, 5, 6, 6, 7, 7, 8, 7, 7, 7, 6, 8, 7, 9, 8, 7, 8, 9, 7, 8, 9, 8, 7, 7, 8, 8, 7, 9, 8, 9, 9, 9, 9, 9, 9, 8, 9, 10, 9, 10, 7, 9, 8, 9, 9, 9, 8, 9, 10, 9, 9, 10, 9, 10, 9, 9, 10, 10, 10, 9, 8, 9, 9, 10, 10, 10, 10, 10
Offset: 0

Views

Author

Ctibor O. Zizka, Mar 06 2008

Keywords

Comments

Appears to be all 10's starting at a(169). - T. D. Noe, Apr 01 2014

Examples

			a(16) = 3 because 2^16 = 65536, which contains 3 distinct decimal digits [3,5,6].
		

Crossrefs

Programs

  • Maple
    A043537 := proc(n) nops(convert(convert(n,base,10),set)) ; end: A137214 := proc(n) A043537(2^n) ; end: seq(A137214(n),n=0..120) ; # R. J. Mathar, Mar 16 2008
    a:=proc(n) options operator, arrow: nops(convert(convert(2^n,base,10),set)) end proc: seq(a(n),n=0..80); # Emeric Deutsch, Apr 02 2008
  • Mathematica
    Table[Length[Union[IntegerDigits[2^n]]], {n, 0, 100}] (* T. D. Noe, Apr 01 2014 *)
  • Python
    def a(n): return len(set(str(2**n)))
    print([a(n) for n in range(99)]) # Michael S. Branicky, Jul 23 2021

Formula

a(n) = A043537(2^n). - R. J. Mathar, Mar 16 2008

Extensions

More terms from R. J. Mathar and Emeric Deutsch, Mar 16 2008

A364121 Stolarsky representation of n.

Original entry on oeis.org

0, 1, 11, 10, 111, 101, 110, 1111, 100, 1011, 1101, 1110, 11111, 1010, 1001, 10111, 1100, 11011, 11101, 11110, 111111, 1000, 10101, 10011, 10110, 101111, 11010, 11001, 110111, 11100, 111011, 111101, 111110, 1111111, 10100, 10001, 101011, 10010, 100111, 101101
Offset: 1

Views

Author

Amiram Eldar, Jul 07 2023

Keywords

Crossrefs

Programs

  • Mathematica
    stol[n_] := stol[n] = If[n == 1, {}, If[n != Round[Round[n/GoldenRatio]*GoldenRatio], Join[stol[Floor[n/GoldenRatio^2] + 1], {0}], Join[stol[Round[n/GoldenRatio]], {1}]]];
    a[n_] := FromDigits[stol[n]]; Array[a, 100]
  • PARI
    stol(n) = {my(phi=quadgen(5)); if(n==1, [], if(n != round(round(n/phi)*phi), concat(stol(floor(n/phi^2) + 1), [0]), concat(stol(round(n/phi)), [1])));}
    a(n) = fromdigits(stol(n));

Formula

Description of an algorithm for calculating a(n):
Let s(1) = {} be the empty set, and for n > 1, let s(n) be the sequence of digits of a(n). s(n) can be calculated recursively by:
1. If n = round(round(n/phi)*phi) then s(n) = s(floor(n/phi^2) + 1) U {0}, where phi is the golden ratio (A001622) and U denotes concatenation.
2. If n != round(round(n/phi)*phi) then s(n) = s(round(n/phi)) U {1}.
a(n) = A007088(A200714(n)).
A268643(a(n)) = A200649(n).
A055641(a(n)) = A200650(n).
A055642(a(n)) = A200648(n).
A043562(a(n)) = A200651(n)

A297778 Number of distinct runs in base-10 digits of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Clark Kimberling, Feb 03 2018

Keywords

Comments

Every positive integers occurs infinitely many times. See A297770 for a guide to related sequences. A043562(n) = a(n) for n=1..100, but not for n=101.

Examples

			14! in base-10: 2,7,0,0,1,7,3,0,1,3,0,0; ten runs, of which 6 are distinct, so that a(14!) = 6.
		

Crossrefs

Cf. A043562 (number of runs, not necessarily distinct), A297770.

Programs

  • Mathematica
    b = 10; s[n_] := Length[Union[Split[IntegerDigits[n, b]]]]
    Table[s[n], {n, 1, 200}]

A379929 Numbers that have the same number of prime factors, counted with multiplicity, as there are runs in their base-10 representation.

Original entry on oeis.org

2, 3, 5, 7, 10, 11, 14, 15, 21, 25, 26, 34, 35, 38, 39, 46, 49, 51, 57, 58, 62, 65, 69, 74, 82, 85, 86, 87, 91, 93, 94, 95, 102, 105, 115, 118, 119, 122, 124, 125, 130, 133, 138, 147, 148, 153, 154, 155, 164, 165, 166, 170, 171, 172, 174, 175, 177, 182, 186, 190, 195, 207, 212, 221, 226, 230, 231
Offset: 1

Views

Author

Robert Israel, Jan 06 2025

Keywords

Comments

Numbers k such that A001222(k) = A043562(k).

Examples

			a(5) = 10 is a term because 10 has two runs (1 and 0) and two prime factors, 2 and 5.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L; L:= convert(n,base,10); nops(L) - numboccur(0, L[2..-1]-L[1..-2]) = numtheory:-bigomega(n) end proc:
    select(filter, [$1..1000]);
  • Mathematica
    A379929Q[n_] := PrimeOmega[n] == Length[Split[IntegerDigits[n]]];
    Select[Range[300], A379929Q] (* Paolo Xausa, Jan 08 2025 *)
  • Python
    from sympy import primeomega
    def ok(n): return primeomega(n) == len(s:=str(n)) - sum(1 for i in range(1, len(s)) if s[i-1] == s[i])
    print([k for k in range(1, 232) if ok(k)]) # Michael S. Branicky, Jan 08 2025

A379930 Numbers that have the same number of divisors as there are runs in their base-10 representation.

Original entry on oeis.org

1, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 113, 121, 169, 199, 211, 223, 227, 229, 233, 277, 289, 311, 331, 337, 361, 433, 443, 449, 499, 529, 557, 577, 599, 661, 677, 733, 773, 811, 841, 877, 881, 883, 887, 911, 961, 977, 991, 997, 1018, 1027, 1037, 1041
Offset: 1

Views

Author

Robert Israel, Jan 06 2025

Keywords

Comments

Numbers k such that A000005(k) = A043562(k).

Examples

			a(5) = 23 is a term because it has two runs, 2 and 3, and two divisors, 1 and 23.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L; L:= convert(n, base, 10); nops(L) - numboccur(0, L[2..-1]-L[1..-2]) = numtheory:-tau(n) end proc:
    select(filter, [$1..1000]);
  • Mathematica
    A379930Q[n_] := DivisorSigma[0, n] == Length[Split[IntegerDigits[n]]];
    Select[Range[1000], A379930Q] (* Paolo Xausa, Jan 08 2025 *)

A379931 Numbers whose maximum exponent in their prime factorization is the number of runs in their base-10 representation.

Original entry on oeis.org

2, 3, 5, 6, 7, 11, 12, 18, 20, 22, 25, 28, 33, 36, 45, 49, 50, 52, 55, 60, 63, 66, 68, 75, 76, 77, 84, 90, 92, 98, 100, 104, 108, 111, 116, 117, 120, 125, 135, 136, 152, 168, 184, 188, 189, 216, 220, 222, 225, 228, 232, 244, 248, 250, 264, 270, 280, 296, 297, 300, 312, 328, 332, 338, 343, 351
Offset: 1

Views

Author

Robert Israel, Jan 06 2025

Keywords

Comments

Numbers k such that A051903(k) = A043562(k).
If k has r runs, maximum exponent m <= r, and is coprime to 10, then 10^(r+1) * k is a term. Therefore this sequence is infinite.

Examples

			a(10) = 22 is a term because 22 = 2 * 11 has maximum exponent 1, and one run in its base 10 representation.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L; L:= convert(n, base, 10); nops(L) - numboccur(0, L[2..-1]-L[1..-2]) = max(ifactors(n)[2][..,2]) end proc:
    select(filter, [$1..1000]);
  • Mathematica
    A379931Q[n_] := n > 1 && Max[FactorInteger[n][[All, 2]]] == Length[Split[IntegerDigits[n]]];
    Select[Range[400], A379931Q] (* Paolo Xausa, Jan 08 2025 *)

A360391 a(n) is the number of distinct sums of nonempty subsets of the digits of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2
Offset: 0

Views

Author

Ctibor O. Zizka, Feb 06 2023

Keywords

Comments

1 <= a(n) <= 2^(1 + floor(log_10(n))) - 1.

Examples

			k = 10: sums of digits are {0, 1, 0 + 1}, distinct sums of digits are {0, 1}, thus a(10) = 2.
k = 11: sums of digits are {1, 1 + 1}, distinct sums of digits are {1, 2}, thus a(11) = 2.
k = 12: sums of digits are {1, 2, 1 + 2}, distinct sums of digits are {1, 2, 3}, thus a(12) = 3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Length[Union[Total /@ Select[Subsets[IntegerDigits[n]], # != {} &]]]; Array[a, 100, 0] (* Amiram Eldar, Feb 06 2023 *)
  • Python
    from itertools import combinations as C
    def a(n):
        v = list(map(int, str(n)))
        return len(set(sum(c) for r in range(1, len(v)+1) for c in C(v, r)))
    print([a(n) for n in range(89)]) # Michael S. Branicky, Feb 19 2023
Showing 1-10 of 11 results. Next