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!)
A171223 Solutions to place plus, minus, multiply or divide signs to a nonzero digits sequence 123456789 so that result of thus described arithmetic operation will be n. 0
161, 151, 127, 152, 129, 123, 135, 135, 149, 162, 157, 140, 134, 131, 150, 129, 134, 140, 161, 156, 126, 134, 143, 122, 123, 150, 137, 146, 141, 131 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Table of n, a(n) for n=1..30.

EXAMPLE

For n=1, a(1)=161 means there exist 161 solutions as following: Solution 1: 1-2/3*45+6+7+8+9=1 Solution 2: 12-34+5-6+7+8+9=1 Solution 3: 1-2+34-56+7+8+9=1 Solution 4: 1*2-3*4-5+6-7+8+9=1 Solution 5: 1*2+3-4*5+6-7+8+9=1 Solution 6: 1-2-3-4+5-6-7+8+9=1 Solution 7: 1+2+3-4-5-6-7+8+9=1 Solution 8: 1*2*3-4-5-6-7+8+9=1 Solution 9: 1*2-3*4*5+6*7+8+9=1 ......... Solution 151: 12*3/4*56/7/8/9=1 Solution 152: 1*2-3-45-6*7+89=1 Solution 153: 1-23-4+5-67+89=1 Solution 154: 1*2-3-4*5-67+89=1 Solution 155: 1+23-45-67+89=1 Solution 156: 1*23+4+56+7-89=1 Solution 157: 123-4*5-6-7-89=1 Solution 158: 123+4-5*6-7-89=1 Solution 159: 123+4+5-6*7-89=1 Solution 160: 1+23+4-5+67-89=1 Solution 161: 1-23+45+67-89=1

PROG

(Excel) VBA Program:

Sub Test() Dim Solutions(1 To 500), result As Single Dim temp As Long, x(1 To 17) As String, op Dim i As Long, j As Long, out As String, num As Long op = Array("+", "-", "*", "/", "") For i = 1 To 9 x(2 * i - 1) = i Next For i = 0 To 5 ^ 8 - 1 temp = i For j = 1 To 8 x(2 * j) = op(temp Mod 5) temp = temp \ 5 Next out = Join(x, "") result = Evaluate(out) If result > 0 Then If result < 501 Then If InStr(result, ".") = 0 Then Solutions(result) = Solutions(result) + 1 End If End If End If Next Debug.Print Join(Solutions, vbCrLf) End Sub

CROSSREFS

Sequence in context: A027553 A159378 A172074 * A278896 A249397 A025350

Adjacent sequences:  A171220 A171221 A171222 * A171224 A171225 A171226

KEYWORD

easy,base,nonn

AUTHOR

Zhining Yang, Dec 05 2009

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 October 6 15:48 EDT 2022. Contains 357269 sequences. (Running on oeis4.)